This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-07
Channels
- # announcements (1)
- # architecture (9)
- # babashka (3)
- # calva (10)
- # clj-http (13)
- # clj-kondo (11)
- # clojure (23)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (112)
- # clojure-uk (4)
- # clojuredesign-podcast (8)
- # clojurescript (10)
- # core-async (5)
- # cursive (7)
- # data-science (15)
- # datascript (2)
- # datomic (29)
- # emacs (5)
- # events (1)
- # hugsql (1)
- # hyperfiddle (9)
- # midje (1)
- # missionary (3)
- # music (1)
- # off-topic (34)
- # polylith (1)
- # re-frame (16)
- # shadow-cljs (117)
- # squint (19)
- # yamlscript (1)
I am missing some basic understanding about how to query using datalog in datascript. For example in the following example
(datascript.core/q
'[:find ?p
:in [[_ _ ?p] ...]
:where
[(and (not (= ?p "A")) (= ?p "B"))]
[(or (= ?p "A") (= ?p "C"))]]
[[0 :prn "A"]
[1 :prn "B"]
[2 :prn "C"]
[3 :prn "D"]])
I would expect #{["B"] ["C"]}
however im getting #{["D"] ["B"] ["A"] ["C"]}
What am I missing? Why is not my :where
clause restricting the result?You're not using the boolean operators correctly, they should wrap the where clauses, e.g. https://docs.datomic.com/cloud/query/query-data-reference.html#and-example
✅ 1