Skip to content

Instantly share code, notes, and snippets.

@fffej
Created July 14, 2009 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fffej/147160 to your computer and use it in GitHub Desktop.
Save fffej/147160 to your computer and use it in GitHub Desktop.
;; From http://norvig.com/paip/patmatch.lisp
(defun match-if (pattern input bindings)
"Test an arbitrary expression involving variables.
The pattern looks like ((?if code) . rest)."
;; *** fix, rjf 10/1/92 (used to eval binding values)
(and (progv (mapcar #'car bindings)
(mapcar #'cdr bindings)
(eval (second (first pattern))))
(pat-match (rest pattern) input bindings)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment