Extract template handling of MATCH[ING] into %TEMPLATE-FOR-MATCH
Tue Jan 12 08:03:54 UTC 2010 pix@kepibu.org
* Extract template handling of MATCH[ING] into %TEMPLATE-FOR-MATCH
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-08 15:45:10.000000000 +0000
+++ new-cl-unification-1/match-block.lisp 2013-07-08 15:45:10.000000000 +0000
@@ -10,6 +10,10 @@
(intern (subseq (symbol-name v) 1)
(symbol-package v)))
+(defun %template-for-match (template)
+ (if (variablep template)
+ `',template ; Logical variables are special-cased.
+ template))
(defmacro match ((template object
&key
@@ -39,9 +43,7 @@
"
(let ((template-vars (collect-template-vars template))
(env-var (gensym "UNIFICATION-ENV-"))
- (template (if (variablep template)
- `',template ; Logical variables are special-cased.
- template))
+ (template (%template-for-match template))
)
(flet ((generate-var-bindings ()
(loop for v in template-vars
@@ -173,10 +175,7 @@
(declare (ignore default-substitution)) ; For the time being.
(labels ((%%match%% (clause-var template object forms substitution)
(let ((template-vars (collect-template-vars template))
- (template (if (variablep template)
- `',template ; Logical variables are
- ; special-cased.
- template))
+ (template (%template-for-match template))
)
(flet ((generate-var-bindings ()
(loop for v in template-vars