chickadee » srfi-116 » iany

iany pred ilist1 ilist2 ...procedure

Applies the predicate across the ilists, returning true if the predicate returns true on any application.

If there are n ilist arguments ilist1 ... ilistn, then pred must be a procedure taking n arguments and returning a boolean result.

iany applies pred to the first elements of the ilisti parameters. If this application returns a true value, iany immediately returns that value. Otherwise, it iterates, applying pred to the second elements of the ilisti parameters, then the third, and so forth. The iteration stops when a true value is produced or one of the ilists runs out of values; in the latter case, iany returns #f. The application of pred to the last element of the ilists is a tail call.

Note the difference between ifind and ianyifind returns the element that satisfied the predicate; iany returns the true value that the predicate produced.

Like ievery, iany's name does not end with a question mark — this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

(iany integer? (iq a 3 b 2.7))   ;=> #t
(iany integer? (iq a 3.1 b 2.7)) ;=> #f
(iany < (iq 3 1 4 1 5)
        (iq 2 7 1 8 2))          ;=> #t