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
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
