g Exercise 5.9 [h] Winston and Horn's book Lisp presents a good pattern-matching program. Compare their implementation

Question:

g Exercise 5.9 [h] Winston and Horn's book Lisp presents a good pattern-matching program. Compare their implementation with this one. One difference is that they handle the case where the first element of the pattern is a segment variable with the following code (translated into our notation):

(or (pat-match (rest pattern) (rest input) bindings)

(pat-match pattern (rest input) bindings))

This says that a segment variable matches either by matching the first element of the input, or by matching more than the first element. It is much simpler than our approach using posi ti on, partly because they don't update the binding list. Can you change their code to handle bindings, and incorporate it into our version of pat -match? Is it still simpler? Is it more or less efficient?

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

Step by Step Answer:

Question Posted: