This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-01
Channels
- # announcements (1)
- # aws (3)
- # beginners (150)
- # boot (12)
- # calva (7)
- # carry (3)
- # cider (1)
- # clara (51)
- # cljdoc (17)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (64)
- # clojure-austin (2)
- # clojure-india (1)
- # clojure-italy (10)
- # clojure-nl (4)
- # clojure-spec (42)
- # clojure-uk (63)
- # clojurescript (24)
- # core-async (23)
- # cursive (6)
- # datascript (7)
- # datomic (5)
- # figwheel-main (43)
- # fulcro (74)
- # hoplon (7)
- # kaocha (30)
- # leiningen (32)
- # mount (51)
- # nrepl (34)
- # off-topic (29)
- # re-frame (6)
- # reagent (10)
- # reitit (13)
- # shadow-cljs (66)
- # slack-help (3)
- # spacemacs (2)
- # specter (5)
- # sql (2)
- # tools-deps (51)
- # yada (13)
I have a somewhat unusual question: Given an AST for a programming language in a Datascript db, is it possible to identify dependencies with their db id, if all dependencies are db.type/ref
? One problem I see is that they might not be immediate children of the node, but further down the tree. I know that datalog supports recursive queries, but my datalog-fu isn't strong enough for that (yet) 😉
The nodes are quite inhomogeneous (It's not a lisp tree sadly), so enumerating all possibilities by hand would be somewhat tedious, but theoretically possible
Maybe some inspiration? https://stackoverflow.com/questions/42457136/recursive-datalog-queries-for-datomic-really-slow
Actually this is a better example: https://github.com/tonsky/datascript/blob/1661c524b544fa0c212bc2db65ef7ad22cecb319/test/datascript/test/pull_api.cljc#L212
Ah, actually the frontpage itself has a good example too:
(d/q '[ :find ?u1 ?u2
:in $ %
:where (follows ?u1 ?u2) ]
[ [1 :follows 2]
[2 :follows 3]
[3 :follows 4] ]
'[ [(follows ?e1 ?e2)
[?e1 :follows ?e2]]
[(follows ?e1 ?e2)
[?e1 :follows ?t]
(follows ?t ?e2)] ])
I was looking for something like that, coding it to a custom rule