This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-23
Channels
- # 100-days-of-code (2)
- # aws (1)
- # beginners (105)
- # boot (36)
- # calva (4)
- # cider (56)
- # clara (37)
- # cljdoc (16)
- # cljs-dev (19)
- # clojure (44)
- # clojure-dev (20)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-serbia (2)
- # clojure-spec (15)
- # clojure-uk (44)
- # clojurescript (41)
- # code-reviews (3)
- # core-async (12)
- # cursive (24)
- # datomic (4)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (168)
- # funcool (2)
- # hyperfiddle (15)
- # jobs (2)
- # jobs-discuss (79)
- # juxt (19)
- # lein-figwheel (1)
- # leiningen (2)
- # luminus (14)
- # mount (8)
- # nrepl (9)
- # off-topic (9)
- # other-languages (1)
- # pathom (32)
- # reitit (6)
- # ring-swagger (3)
- # shadow-cljs (10)
- # slack-help (11)
- # spacemacs (20)
- # sql (29)
- # tools-deps (28)
- # vim (29)
- # yada (4)
{:type :foo
:desc "'Foo' node"
:parent :D}
{:type :D
:desc "'D' node"
:parent :C}
{:type :C
:desc "'C' node"
:parent :B}
{:type :B
:desc "'B' node"
:parent :A}
{:type :A
:desc "'A' node"}
'(:?node {:type :foo
:desc "'Foo' node"
:parent :D}
:?parents [{:type :D
:desc "'D' node"
:parent :C}
{:type :C
:desc "'C' node"
:parent :B}
{:type :B
:desc "'B' node"
:parent :A}
{:type :A
:desc "'A' node"}])
So you'd have one rule that's (heavily abbreviating the code): [:test (no-children? ?node)] => (insert! (->TreeRep ?node ?node))). And one that's [:test (children? ?node)] ?children <- (acc/all) :from [Node (= parent ?node)] => (insert! (->TreeRep ?node (add-children ?node ?children))).
It might be doable with one rule, actually. But the point is, AFAICT, there's no way to recurse without inserting facts.
You could also do this with a custom accumulator, but that would be much harder, I'm guessing.
By the way, 👋 clara people! We are starting to rely heavily on this for work, and it is a good thing.
We are storing data in Datomic, and importing the facts, and deriving a bunch of stuff from them.
This includes constraint validation, what we are calling "synthetic attributes", which are computed attributes.
ah yeah, it was this clara-eav https://github.com/clyfe/clara-eav
@U0LK1552A This actually looks pretty neat. Our library does a different thing, regarding bulk loading facts from datomic and caching intermediate sessions to save work. It seems like we could use them together.