Next: lists fold pair, Previous: lists fold traditional, Up: lists fold [Index]
Like fold-left*
and fold-right*
, but stop the folding if
the value returned by combine is #f
, in which case the
return value is #f
.
Apply pred to successive couples of elements from circ;
return true if all the evaluations of pred were true. The
iteration stops at the first #f
return value from pred.
This function is implemented as:
(define (fold-left/pred pred knil ell) (and-fold-left*/stx (lambda (knil item) (and (pred knil item) item)) knil ell))
and it can be used to implement predicates for ordering like <
:
(fold-left/pred < 0 '(1 2 3 4 5 6)) ⇒ 6 (fold-left/pred < 0 '(1 2 3 -4 5 6)) ⇒ #f