previous | index | next

Exercise 7.37 – matches?

Before querying the database, the test file will make sure your new matches? predicate works correctly by running these tests:
(assert (equal? (matches?-for-7.37 '(a number? c) 
                                   '(a b c))
                #f))

(assert (equal? (matches?-for-7.37 '(a symbol? c) 
                                   '(a b c))
                #t))

(assert (equal? (matches?-for-7.37 '(a number? c) 
                                   '(a 13 c))
                #t))

(assert (equal? (matches?-for-7.37 '(number? number? number?) 
                                   '(a 13 c))
                #f))

(assert (equal? (matches?-for-7.37 '(number? b number?) 
                                   '(12 b 14))
                #t))

(assert (equal? (matches?-for-7.37 '(number? b number?) 
                                   '(12 c 14))
                #f))

(assert (equal? (matches?-for-7.37 '(symbol? number? symbol?) 
                                   '(12 13 14))
                #f))

(assert (equal? (matches?-for-7.37 '(symbol? number? symbol?) 
                                   '(a 13 c))
                #t))

previous | index | next