chickadee » srfi-40 » stream-filter

stream-filter predicate? streamprocedure

stream-filter applies predicate? to each element of stream and creates a newly allocated stream consisting of those elements of the given stream for which predicate? returns a non-#f value. Elements of the output stream are in the same order as they were in the input stream, and are tested by predicate? in order.

(stream-filter odd? stream-null)            => stream-null
(take5 (stream-filter odd? from0))          => (stream 1 3 5 7 9)