Skip to content

Instantly share code, notes, and snippets.

@dsbw
Created September 13, 2016 21:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dsbw/90ac0018f388088e1cdee0ba3743c88a to your computer and use it in GitHub Desktop.
How to recurse in logic...?
(defn allowed-values [constraints]
(cond
(nil? constraints) (run* [q])
(coll? constraints) (run* [q] (membero q constraints)) ;;<--works but not recursively
;;(coll? constraints) (run* [q] (first constraints))
(keyword? constraints) (allowed-values (translate-symbol constraints))
:else (run* [q] (== constraints q)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment