Pattern Matching
Pattern matching is the inverse of substitution: it tests to see whether an input is an instance of a pattern, and if so, how it matches.
>(match '(go ?expletive yourself) '(go bleep yourself)) ((?EXPLETIVE BLEEP) (T T)) (match '(defun ?fun (tree) (if (consp tree) (?combine (?fun (car tree)) (?fun (cdr tree))) (if (?test tree) ?trueval ?falseval))) '(DEFUN NNUMS (TREE) (IF (CONSP TREE) (+ (NNUMS (CAR TREE)) (NNUMS (CDR TREE))) (IF (NUMBERP TREE) 1 0))) ) ((?FALSEVAL 0) (?TRUEVAL 1) (?TEST NUMBERP) (?COMBINE +) (?FUN NNUMS) (T T))