Functions defined on streams with entries in two sets.
- map: (A -> B, Stream A) -> Stream B
map(f, s)returns a stream whose elements are the function
fapplied to the corresponding elements of
map(f, [x0, x1, x2, ...]) = [f(x0), f(x1), f(x2), ..].
- reduce: (B, (A, B) -> B, Stream A) -> B
reduce(b, f, u), where
uis a finite stream
[x0, x1, ..., xn], returns the value
r(n)computed as follows:
r0 = f(x0, b), r1 = f(x1, r0), ..., r(n) = f(xn, r(n-1)).