any-of

Category: Type procedures

Documentation

;;; (any-of pred_1? ... pred_n?) -> unary-predicate?
;;;   pred_1? : unary_predicate?
;;;   ...
;;;   pred_n? : unary-predicate
;;; Returns a predicate of one parameter, `val`, that checks whether any
;;; of `pred_1?` ... `pred_n?` hold on `val`.

Examples

Forthcoming

Sample implementation (advanced)

(define any-of
  (letrec ([kernel (lambda (preds val)
                     (and (not (null? preds))
                          (or ((car preds) val)
                              (kernel (cdr preds) val))))])
    (lambda preds
      (lambda (val)
        (kernel preds val)))))

Tests

Forthcoming

See also

Forthcoming

Questions

Forthcoming