Tue Jun 15 03:21:37 UTC 2010 pix@kepibu.org
* Pull variable binding out of %match-expander
I'd like to tell you this is part of a plan to simplify %match-expander, but in
all honesty, the only reason I'm doing it is because I found myself thinking
with-unification-variables would be a handy macro while working on a private
extension to cl-unification, and I didn't want to duplicate the code.
hunk ./match-block.lisp 13
+(defmacro with-unification-variables ((&rest variables) environment &body body)[_^M_][_$_]
+ "Execute body with variables bound to their values in environment."[_^M_][_$_]
+ (flet ((variable-bindings (v)[_^M_][_$_]
+ `((,v (find-variable-value ',v ,environment))[_^M_][_$_]
+ (,(clean-unify-var-name v) ,v))))[_^M_][_$_]
+ `(let* ,(mapcan #'variable-bindings variables)[_^M_][_$_]
+ (declare (ignorable ,@(mapcar #'clean-unify-var-name variables)))[_^M_][_$_]
+ ,@body)))[_^M_][_$_]
+[_^M_][_$_]
hunk ./match-block.lisp 93
- (bind-variable (v)[_^M_][_$_]
- `((,v (find-variable-value ',v ,match-environment))[_^M_][_$_]
- (,(clean-unify-var-name v) ,v)))[_^M_][_$_]
hunk ./match-block.lisp 100
- (let* ,(mapcan #'bind-variable variables)[_^M_][_$_]
- (declare (ignorable ,@variables ,@(mapcar #'clean-unify-var-name variables)))[_^M_][_$_]
+ (with-unification-variables ,variables ,match-environment[_^M_][_$_]