cl-unification
Provides unification (as used in Prolog) over fairly arbitrary Common Lisp objects.

Examples:

A simple match:

(unify 42 ?x) ;; => #<ENVIRONMENT xxxxxx> (find-variable-value '?x *) ;; => 42

Unification over a list:

(unify '(1 2 3 4 5) #T(list 1 ?x &rest ?rest)) ;; => #<ENVIRONMENT xxxxxxx> (find-variable-value '?rest *) ;; => (3 4 5) ;; T

Unification over a vector:

(unify #(1 2 3 4 5) #T(vector 1 ?x &rest ?rest)) ;; => #<ENVIRONMENT xxxxxxx> (find-variable-value '?rest *) ;; => #(3 4 5)

Unification over a structure:

(defstruct foo () (a 42)) ;; => FOO (defstruct (baz (:include foo)) (b 33)) ;; => BAZ (unify (make-baz) #T(foo foo-a ?x)) ;; => #<ENVIRONMENT xxx> (find-variable-value '?x *) ;; => 42 ;; T

Homepage: http://common-lisp.net/project/cl-unification/

License: BSD

Repository: common-lisp.net

pattern matching, unification