Another useful feature is to allow the user to specify an arbitrary predicate that a match must

Question:

Another useful feature is to allow the user to specify an arbitrary predicate that a match must satisfy. The notation (?is ?n numberp) could be used to match any expression that is a number and bind it to the variable ?n. This would look like:

> (pat-match '(x = (?is ?n numberp)) '(x = 34)) ((?n . 34))

> (pat-match '(x = (?is ?n numberp)) '(x = x)) + NIL Since patterns are like boolean expressions, it makes sense to allow boolean operators on them. Following the question-mark convention, we will use ?and, ?or and ?not for the operator^.^ Here is a pattern to match a relational expression with one of three relations. It succeeds because the < matches one of the three possibilities specified by (?or <=>I.

> (pat-match '(?x (?or < = >) ?y) '(3 < 4)) + ((?Y . 4) (?X . 3))

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: