Make MATCHING agree with MATCH[F][-CASE] about the conditions of failure
Fri Jan 15 07:59:02 UTC 2010 pix@kepibu.org
* Make MATCHING agree with MATCH[F][-CASE] about the conditions of failure
Rather than skipping to the next clause on any error, UNIFICATION-FAILUREs--and
/only/ UNIFICATION-FAILUREs--skip to the next clause.
diff -rN -u old-cl-unification-1/match-block.lisp new-cl-unification-1/match-block.lisp
--- old-cl-unification-1/match-block.lisp 2013-07-03 17:37:19.000000000 +0000
+++ new-cl-unification-1/match-block.lisp 2013-07-03 17:37:19.000000000 +0000
@@ -167,7 +167,7 @@
(let ((template (%template-for-match template))
)
`((setf ,clause-var
- (unify* ,template ,object ,substitution))
+ (unify** ,template ,object ,substitution))
,(%wrap-var-bindings template clause-var forms))
))
diff -rN -u old-cl-unification-1/unifier.lisp new-cl-unification-1/unifier.lisp
--- old-cl-unification-1/unifier.lisp 2013-07-03 17:37:19.000000000 +0000
+++ new-cl-unification-1/unifier.lisp 2013-07-03 17:37:19.000000000 +0000
@@ -859,6 +859,11 @@
(defun unify* (a b &optional (env (make-empty-environment)))
(ignore-errors (unify a b env)))
+(defun unify** (a b &optional (env (make-empty-environment)))
+ (handler-case
+ (unify a b env)
+ (unification-failure (c) (values nil c))))
+
(defun unify-equations (eqns &optional (env (make-empty-environment)))
(loop for (a b) in eqns