Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Chlorine's datalog ideas
;; What I want to do is something like this:
(def res
(query '[:find ?meta
:where
[?e :editor/contents "p/deferred"]
[?e :editor/ns "foo.bar"]
[?fqn :repl/fqn ?e]
[?var :repl/var ?fqn]
[?meta :repl/meta ?fqn]]))
;; This should generate maybe the following query:
(let [fqn (repl/eval "`p/deferred" {:namespace "foo.bar"})
var (repl/eval "(var promesa.core/deferred)")
meta (repl/eval "(meta #'promesa.core/deferred)")]
meta)
;; This, all in ClojureScript, so promise / async support is a must!
;; meta should be the full metadata, so maybe I can even query it further...
;; Bonus points if I could generate queries on the flight, like:
(def res
(query '[:find ?meta
:where
[?e :editor/contents "p/deferred"]
[?e :editor/ns "foo.bar"]
[?fqn :repl/fqn ?e]
[?eval-cmd (str "(meta (var " ?fqn "))")]
[?meta :repl/eval ?eval-cmd]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment