A unification library for Clojure.
Usage: (extract-lvars form)
(extract-lvars lv-fn form)
Takes a datastructure and returns a distinct set of the logical variables found within.Source
Usage: (flatten-bindings binds)
(flatten-bindings variable? binds)
Flattens recursive bindings in the given map to the same ground (if possible).Source
Usage: (make-occurs-subst-fn variable-fn)
Given a function to recognize unification variables, returns a function that will attempt to substitute unification bindings between two expressions. This function uses an 'occurs check' methodology for detecting cycles.Source
Usage: (make-occurs-unifier-fn variable-fn)
Given a function to recognize unification variables, returns a function to perform the unification of two expressions. This function uses an 'occurs check' methodology for detecting cycles.Source
Usage: (make-occurs-unify-fn variable-fn)
Given a function to recognize unification variables, returns a function to return a bindings map for two expressions. This function uses an 'occurs check' methodology for detecting cycles.Source
Usage: (make-subst-fn variable-fn)
Given a function to recognize unification variables, returns a function that will attempt to substitute unification bindings between two expressions.Source
Usage: (make-unifier-fn variable-fn)
Given a function to recognize unification variables, returns a function to perform the unification of two expressions.Source
Usage: (make-unify-fn variable-fn)
Given a function to recognize unification variables, returns a function to return a bindings map for two expressions.Source
Usage: (subst expression bindings)
Attempts to substitute the bindings in the appropriate locations in the given expression.Source
Usage: (unifier expression1 expression2)
Attempts the entire unification process from garnering the bindings to substituting the appropriate bindings. Note: This function is implemented with an occurs-check.Source
Usage: (unifier- expression1 expression2)
Attempts the entire unification process from garnering the bindings to substituting the appropriate bindings. Note: This function is implemented **without** an occurs-check.Source
Usage: (unify expression1 expression2)
Attempt to unify x and y with the given bindings (if any). Potentially returns a map of the unifiers (bindings) found. Will throw an `IllegalStateException` if the expressions contain a cycle relationship. Will also throw an `IllegalArgumentException` if the sub-expressions clash. Note: This function is implemented with an occurs-check.Source
Usage: (unify- expression1 expression2)
Attempt to unify x and y with the given bindings (if any). Potentially returns a map of the unifiers (bindings) found. Will throw an `IllegalStateException` if the expressions contain a cycle relationship. Will also throw an `IllegalArgumentException` if the sub-expressions clash. Note: This function is implemented **without** an occurs-check.Source