Skip to content

Instantly share code, notes, and snippets.

@jirkamarsik
Created December 18, 2012 00:49
Show Gist options
  • Save jirkamarsik/4323906 to your computer and use it in GitHub Desktop.
Save jirkamarsik/4323906 to your computer and use it in GitHub Desktop.
A macro for collecting all predicates of a given class from my namespace and wrapping them in a disjunction.
(defmacro transformo
"Is satisfied when out-tree is a normalized version of the in-tree
node. Tries to use any goal annotated with ::rule."
[in-tree out-tree]
`(conde ~@(for [[sym var] (ns-interns *ns*)
:when (::rule (meta var))]
[(list sym in-tree out-tree)])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment