Created
October 5, 2020 22:47
-
-
Save mauricioszabo/8e67c0ee2116f78476f058ad96f31d30 to your computer and use it in GitHub Desktop.
Chlorine's datalog ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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