Fork me on GitHub
#datascript
<
2018-04-30
>
rnagpal20:04:21

Just got started with datascript queries. I see that we can use predicates. predicates can compare a property with the provided value But I have a predicate, which takes an entity. How can I pass entity to the predicate? I have

(defn event-matches-1 [event start-time end-time categories levels] 
... )

[:find ?e
                :in $ ?start ?end ?categories ?levels
                :where
                [(user/event-matches-1 ?e ?start ?end ?categories ?levels)]]
in the function/predicate event-matches-1 I get event as nil

javi22:04:34

haven't done much datascript lately but looks like ?e is not bound to anything in the query? for example...

:where
[?e :my/name ?name]
 [(user/event-matches-1 ?e ?start ?end ?categories ?levels)]]

👍 4