(defun equal (pat inp) (if (consp pat) ; interior node? (and (consp inp) (equal (first pat) (first inp)) (equal (rest pat) (rest inp))) (eql pat inp) ) ) ; leaf node (defun match (pat inp) (matchb pat inp '((t t)))) (defun matchb (pat inp bindings) (and bindings (if (consp pat) ; interior node? (and (consp inp) (matchb (rest pat) (rest inp) (matchb (first pat) (first inp) bindings))) (if (varp pat) ; leaf: variable? (let ((binding (assoc pat bindings))) (if binding (and (equal inp (second binding)) bindings) (cons (list pat inp) bindings))) (and (eql pat inp) bindings)) ) ) )
Contents    Page-10    Prev    Next    Page+10    Index