This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-10
Channels
- # announcements (3)
- # babashka (16)
- # beginners (41)
- # biff (4)
- # calva (14)
- # circleci (1)
- # clj-http (24)
- # clj-kondo (9)
- # clj-on-windows (31)
- # cljs-dev (52)
- # clojure (162)
- # clojure-australia (10)
- # clojure-europe (52)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-uk (5)
- # clojurescript (40)
- # conjure (6)
- # core-async (3)
- # cursive (5)
- # datalevin (11)
- # datomic (7)
- # emacs (12)
- # etaoin (19)
- # events (1)
- # figwheel-main (17)
- # fulcro (4)
- # graalvm (3)
- # gratitude (13)
- # honeysql (8)
- # introduce-yourself (7)
- # london-clojurians (1)
- # off-topic (9)
- # polylith (9)
- # rdf (1)
- # re-frame (21)
- # releases (5)
- # remote-jobs (4)
- # sci (28)
- # shadow-cljs (15)
- # spacemacs (2)
- # vim (4)
- # xtdb (15)
is there any way to transform a result from :find (within the query itself)? for example, to create a query that returns true
if [?somevar ...] has one or more elements in it and false
if it has zero elements / is empty
An attribute cant be nil (only be omitted); but you can use an or/or-join to do this.
(or
(and [?e :arrt _] [(ground true) ?mybool])
(and (missing? ?e :attr) [(ground false) ?mybool]))
Here ?mybool is bound to either true or false depending if the preceding clause matches
(Alternatively this can be expressed as a datomic rule too)Thank you. I was wondering if it might have been possible within the :where bindings
both or
clauses refer to the same set of variables (`?e` and ?mybool
), so i don't think u need or-join
.
> An or-join clause is similar to an or clause, but it allows you to specify which variables should unify with the surrounding clause; only this list of variables needs binding before the clause can run. The /variable/s specifies which variables should unify.
— https://docs.datomic.com/cloud/query/query-data-reference.html#or-join