In the first example below, the segment variable ?x matches the sequence (b c 1. In the
Question:
In the first example below, the segment variable ?x matches the sequence (b c 1. In the second example, there are two segment variables in a row. The first successful match is achieved with the first variable, ?x, matching the empty sequence, and the second one, ?y, matching ( b c 1.
> (pat-match '(a (?* ?XI
d) '(a b c dl) + ((?X B C))
> (pat-match '(a (?* ?XI (?* ?y) dl ' ( a b c dl) + ((?Y B C) (?XI)
In the next example, ?x is first matched against nil and ?y against ( b c d 1, but that fails, so we try matching ?x against a segment of length one. That fails too, but finally the match succeeds with ?x matching the two-element segment ( b c 1, and ?y matching ( d 1.
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: