replikativ / datahike

A fast, immutable, distributed & compositional Datalog engine for everyone.
https://datahike.io
Eclipse Public License 1.0
1.62k stars 95 forks source link

Support pull patterns being sets #686

Closed jonasseglare closed 2 months ago

jonasseglare commented 2 months ago

Describe the feature you would like to request

It would be nice to be able to provide pull patterns being sets, so that we can, for example, write code like this:

  (is (= (d/q '[:find (pull ?e #{:name}) .
                :where [?e :age 25]]
              test-db)
         {:name "Ivan"}))

where the pull pattern is a set: #{:name}. This kind of syntax is supported by Datomic, so it would be good if Datahike supports it too.

Support for this was added in the datalog-parser recently: https://github.com/replikativ/datalog-parser/commit/e2c0f3dd8ababbc07bcbd5ce22e1fd1d36b7f85e

Describe the solution you would like

We just have to update the datalog-parser dependency:

io.replikativ/datalog-parser                {:mvn/version "0.2.29"}

Describe alternatives you've considered

We could choose to not change the API and force the user to always provide pull patterns that are sequential?. But this incompatibility with Datomic might be less convenient for the user.