Fixed two major bugs reported by Norman Werver. Unification of
Fri May 20 15:19:53 UTC 2005 mantoniotti
* Fixed two major bugs reported by Norman Werver. Unification of
Fixed two major bugs reported by Norman Werver. Unification of
strings and symbols and of numers and symbols was not recurring on
VAR-UNIFY, as required; thus
(unify '(?x ?x) '("asd" "qweert"))
and
(unify '(foo ?x baz) '(foo 42 ?x))
would succed.
The two cases are now fixed.
diff -rN -u old-cl-unification-1/unifier.lisp new-cl-unification-1/unifier.lisp
--- old-cl-unification-1/unifier.lisp 2013-07-21 19:58:48.000000000 +0000
+++ new-cl-unification-1/unifier.lisp 2013-07-21 19:58:48.000000000 +0000
@@ -94,15 +94,15 @@
(defmethod unify ((a symbol) (b string) &optional (env (make-empty-environment)))
(cond ((variable-any-p a) env)
- ((variablep a) (extend-environment a b env))
+ ((variablep a) (var-unify a b env))
(t (error 'unification-failure
- :format-control "Cannot unify a symbol with a string: ~S ~S."
- :format-arguments (list a b)))))
+ :format-control "Cannot unify a symbol with a string: ~S ~S."
+ :format-arguments (list a b)))))
(defmethod unify ((b string) (a symbol) &optional (env (make-empty-environment)))
(cond ((variable-any-p a) env)
- ((variablep a) (extend-environment a b env))
+ ((variablep a) (var-unify a b env))
(t (error 'unification-failure
:format-control "Cannot unify a string with a symbol: ~S ~S."
:format-arguments (list b a)))))
@@ -121,13 +121,13 @@
(defmethod unify ((a symbol) (b t) &optional (env (make-empty-environment)))
(cond ((variable-any-p a) env)
- ((variablep a) (extend-environment a b env))
+ ((variablep a) (var-unify a b env))
(t (call-next-method))))
(defmethod unify ((b t) (a symbol) &optional (env (make-empty-environment)))
(cond ((variable-any-p a) env)
- ((variablep a) (extend-environment a b env))
+ ((variablep a) (var-unify a b env))
(t (call-next-method))))