stream.spad line 1194 [edit on github]
Functions defined on streams with entries in two sets.
map(f, s)
returns a stream whose elements are the function f
applied to the corresponding elements of s
. Note: map(f, [x0, x1, x2, ...]) = [f(x0), f(x1), f(x2), ..]
.
reduce(b, f, u)
, where u
is 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))
.
scan(b, h, [x0, x1, x2, ...])
returns [y0, y1, y2, ...]
, where y0 = h(x0, b)
, y1 = h(x1, y0)
, ...
yn = h(xn, y(n-1))
.