chickadee » srfi-116 » icount

icount pred ilist1 ilist2 ...procedure

pred is a procedure taking as many arguments as there are ilists and returning a single value. It is applied element-wise to the elements of the ilists, and a count is tallied of the number of elements that produce a true value. This count is returned. count is "iterative" in that it is guaranteed to apply pred to the ilist elements in a left-to-right order. The counting stops when the shortest ilist expires.

(count even? (iq 3 1 4 1 5 9 2 5 6))            ;=> 3
(count < (iq 1 2 4 8) (iq 2 4 6 8 10 12 14 16)) ;=> 3