Skip to content

Instantly share code, notes, and snippets.

@Jannis
Created January 18, 2016 16:00
Show Gist options
  • Save Jannis/8fd22f556b55f02589bf to your computer and use it in GitHub Desktop.
Save Jannis/8fd22f556b55f02589bf to your computer and use it in GitHub Desktop.
(defn popular? [friends]
(> (count friends) 2))
(d/q '[:find (boot.user/popular? ?f) .
:in $ ?u
:where [?u :user/friends ?f]]
(d/db conn)
(:db/id some-user))
;; The above works fine if :user/friends is set, however, if it is unset
;; (no friends at all), popular? is never called and the result is nil.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment