chickadee » srfi-196 » range-count

range-count pred range₁ range₂ procedure

Applies pred element-wise to the elements of ranges and returns the number of applications which returned true values. If more than one range is given and not all ranges have the same length, range-count terminates when the shortest range is exhausted. The runtime of this procedure is O(s) where s is the sum of the total accessing times of the ranges.

Examples:

(range-count even? (numeric-range 0 10)) ⇒ 5
(range-count < (numeric-range 0 10 2) (numeric-range 5 15)) ⇒ 5