Before you take a look at the solutions, it is strongly recommended that you try to solve the problems on your own.
1. The procedure type-check from problem 9.15 can be written as follows:
(define (type-check f pred?) (lambda (x) (if (pred? x) (f x) #f)))
Write the procedure safe-bf in terms of type-check. Make sure that safe-bf works for both sentences and words. It may be helpful to recall that safe-sqrt was defined as follows:
(define safe-sqrt (type-check sqrt number?))
2. Write the predicate num-vowels? that takes a sentence as its input and returns the number of vowels in the sentence.
> (num-vowels? '(i am cheese)) 5
3. Predict what this will evaluate to, then try it in the interpreter to see if you got it right.
(accumulate (lambda (c1 c2) (word 'a c1 c2)) '(br c d br "" ""))