Skip to content

Instantly share code, notes, and snippets.

@slagyr
Created January 22, 2014 15:55
Show Gist options
  • Save slagyr/8561271 to your computer and use it in GitHub Desktop.
Save slagyr/8561271 to your computer and use it in GitHub Desktop.
(defn not-set
"Returns true if attr is not set for e"
[db e attr]
(let [result (api/q '[:find ?v
:in $ ?e ?a
:where [?e ?a ?v]]
db e attr)]
(-> result first empty?)))
(defn pets-without-tails [owner-id]
(api/q '[:find ?e
:in $ ?owner-id
:where
[?e :pet/owner ?owner-id]
[(my-ns/not-set $ ?e :pet/tail)]]
(db/db) owner-id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment