;;;; -*- Mode: Lisp -*- ;;;; match-block.lisp -- ;;;; Various macros built on top of the unifier: MATCH, MATCHING and MATCH-CASE. ;;;; See file COPYING for copyright licensing information. (in-package "UNIFY") (defun clean-unify-var-name (v) (assert (variablep v)) (intern (subseq (symbol-name v) 1) (symbol-package v))) (defmacro with-unification-variables ((&rest variables) environment &body body) "Execute body with variables bound to their values in environment." (flet ((variable-bindings (v) `((,v (find-variable-value ',v ,environment)) (,(clean-unify-var-name v) ,v)))) `(let* ,(mapcan #'variable-bindings variables) (declare (ignorable ,@(mapcar #'clean-unify-var-name variables))) ,@body))) (defun %match-expander (template-munger clause-munger clauses &key default named environment errorp error-form keyform) "A rather hairy internal function which handles expansion for all the MATCH* macros. template-munger should be either 'match or 'matchf, and will massage the template into the proper form for that macro set. clause-munger should be either 'cond, 'case, or 'nil. This affects the expected syntax of items in clauses as follows: 'cond: { ((