I have been trying to understand this exercise 8.10 in "simply scheme", but just cannot grasp it in Dr Racket..
It's this one: Write a predicate true-for-all? that takes two arguments, a predicate procedure and a sentence. It should return #t if the predicate argument returns true for every word in the sentence.
(true-for-all? even? ’(2 4 6 8))
T
(true-for-all? even? ’(2 6 3 4))
F
I tried the solution:
(define (true-for-all? pred sent) (= (count sent) (count (keep pred sent))))
but Dr Racket gives errors like count: arity mismatch. Is anyone able to rewrite it or at least give some hints. Appreciated a lot:)
Best Regards, Eunice