The next pattern uses ?not to insure that two parts are not equal: > (pat-match '(?x /=
Question:
The next pattern uses ?not to insure that two parts are not equal:
> (pat-match '(?x /= (?not ?XI) '(3 /= 4)) =. ((?X . 3))
The segment matching notation we have seen before. It is augmented to allow for three possibilities: zero or more expressions; one or more expressions; and zero or one expressions. Finally, the notation ( ? i f exp ) can be used to test a relationship between several variables. It has to be listed as a segment pattern rather than a single pattern because it does not consume any of the input at all:
> (pat-match '(?x > ?y (?if (> ?x ?y))) '(4 > 3)) 3
((?Y . 3) (?X . 4))
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: