(define matches? (lambda (pattern question) (cond ((null? pattern) (null? question)) ((null? question) #F) ((list? (car pattern)) (if (member (car question) (car pattern)) (matches? (cdr pattern) (cdr question)) #F)) ((equal? (car pattern) (car question)) (matches? (cdr pattern) (cdr question))) ((equal? (car pattern) '...) #T) (else #F))))This extension will allow these to match:
(what movies was made in 1967) (what (movie movies) (was were) made in _)Further extending matches? to deal with the "_" wild-card is an exercise (7.29).
substitutions-in-to-match must also be modified to handle both these types of wild-cards (exercise 7.30).