Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
query info for datomic
;;takes datomic query and turns it into map so it may be interrogated
(defn query-info [query]
(let [parts (partition-by keyword? query)
is-kw #(keyword? (first %))]
(zipmap
(map first (filter is-kw parts))
(remove is-kw parts))))
;;eg
((query-info '[:find ?x ?y ?z :in $ ?d :where [?x :some/thing ?y] [?x :some/otherthing ?z]]) :find)
;;yields
(?x ?y ?z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment