chickadee » srfi-1 » any

any pred clist_1 clist_2 ...procedure

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

If there are N list arguments CLIST_1 ... CLIST_N, then PRED must be a procedure taking N arguments and returning a boolean result.

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

Note the difference between find and any -- find returns the element that satisfied the predicate; any returns the true value that the predicate produced.

Like every, any'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.

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