I am learning about Datomic queries and was curious about how to do “parameter queries.”
This is what I came up with:
(d/q '[:find ?n ?x :where [?n :likes ?x] [(= ?x "pizza")]]
[['ethel :likes "sushi"]['fred :likes "pizza"]])
=> #<HashSet [[fred "pizza"]]>
Is this it, or is there a more more concise / idiomatic way of accomplishing the above?
The answer is in the section “Advanced Queries” of the Datomic tutorial
Use the
:inclause:in $ ?xis the parameter clause and the trailing"sushi"is bound to?x