The last thing to do is define the individual matching functions. First, the singlepattern matching functions: (defun
Question:
The last thing to do is define the individual matching functions. First, the singlepattern matching functions:
(defun match-is (var-and-pred input bindings)
"Succeed and bind var if the input satisfies pred, where var-and-pred is the list (var pred)."
(1 et* ((var (first var-and-pred)
(pred (second var-and-pred))
(new-bindings (pat-match var input bindings)))
(if (or (eq new-bindings fail)
(not ( f uncal 1 pred input 1)
fail new-bindings)))
(defun match-and (patterns input bindings)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Paradigms Of Artificial Intelligence Programming Case Studies In Common Lisp
ISBN: 9781558601918
1st Edition
Authors: Peter Norvig
Question Posted: