Fork me on GitHub
#datascript
<
2020-10-08
>
Lone Ranger16:10:16

You can do arbitrary predicates, but it's not well documented

Lone Ranger16:10:21

let me see if I can get an example

Lone Ranger16:10:35

You can also do transaction functions

Lone Ranger16:10:50

IIRC the trick is to use fully qualified symbols

Lone Ranger16:10:58

i.e.,

(defn my-pred=+1 [a b]
  (= a (inc b))

(d/q '[:find ?e 
       :where 
       [?e :a ?a]
       [?e :b ?b]
       [(#'my-pred ?a ?b) ?c]]
  @conn)

👍 3
lilactown16:10:39

How does that even work under advanced compilation

zane17:10:23

That’s interesting. What we’ve been doing is passing the predicates in as inputs to the query.

👍 3
David Pham17:10:26

I think it is even in the documentation.