(for-all '(integer? zero?) '(0 0 0)) is the same as
(for-all '(integer? zero?) '(0 0 0) and)
this returns true if all members of the list satisfy all of the test conditions. If we wrote
(for-all '(integer? zero?) '(0 1 2) or)
this returns true if any of the test functions apply. Here is a sample implementation of the function:
Code: Select all
;; New FOR-ALL
(define (forall test lst (op and))
(if-not (list? test)
(for-all test lst)
(apply op (map for-all test (dup lst (length test))))))