1234567891011121314151617181920212223242526 |
- (define-module (predicates)
- #:export (any-pred? all-pred?))
- (use-modules
- ;; for fold
- (srfi srfi-1))
- (define any-pred?
- (λ (lst pred)
- (fold (λ (current-elem accumulated)
- (or (pred current-elem)
- accumulated))
- #f
- lst)))
- (define all-pred?
- (λ (lst pred)
- (fold (λ (current-elem accumulated)
- (and (pred current-elem)
- accumulated))
- #t
- lst)))
|