|
Q: If pattern is empty, what must question be to match?
A: Empty Q: If pattern is not empty but question is, can they match? A: No Q: If the head of pattern is equal to the head of question, when do the whole pattern and question match? A: When their tails match. Q: What if the head of pattern is equal to "..."? A: Then pattern and question match |
(define matches?
(lambda (pattern question)
(cond ((null? pattern) (null? question))
((null? question) #F)
((equal? (car pattern) (car question))
(matches? (cdr pattern) (cdr question)))
((equal? (car pattern) '...) #T)
(else #F))))
|