This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-12
Channels
- # beginners (36)
- # boot (11)
- # cider (10)
- # cljs-dev (10)
- # cljsrn (3)
- # clojure (103)
- # clojure-greece (1)
- # clojure-italy (16)
- # clojure-nl (3)
- # clojure-spec (59)
- # clojure-uk (129)
- # clojurescript (125)
- # data-science (29)
- # datomic (30)
- # emacs (12)
- # events (5)
- # fulcro (61)
- # graphql (5)
- # keechma (3)
- # leiningen (9)
- # luminus (7)
- # onyx (26)
- # re-frame (3)
- # reagent (56)
- # reitit (25)
- # ring-swagger (16)
- # shadow-cljs (44)
- # spacemacs (4)
- # specter (2)
- # tools-deps (7)
- # vim (8)
Is there a way to do equality in rules? My use case here is a rule for a hierarchy, where I'd want to match in the case that: the two args are equal, the second arg is a parent of the first (via :parent
relationship), or the second arg is a grand-parent (or recursively great-grandparent) of the first arg. The parent and grandparent cases are pretty straightforward, it's that equal case that's tripping me up
I have now:
'[[(in-hierarchy ?child ?parent)
[(= ?child ?parent)]]
[(in-hierarchy ?child ?parent)
[?child :parent ?parent]]
[(in-hierarchy ?child ?parent)
[?child :parent ?p1]
(in-hierarchy ?p1 ?parent)]]
The clause with =
is throwing, thoughIllegalArgumentExceptionInfo :db.error/insufficient-binding [?child] not bound in expression clause: [(= ?child ?parent)] datomic.error/arg (error.clj:57)