UNPKG

rafa

Version:

Rafa.js is a Javascript framework for building concurrent applications.

18 lines (13 loc) 470 B
Scan all values and emit a new value that is the product of calling a function that evaluates the previous and current values. This method is like `fold` except that it produces a new value for every upstream value. <aside> ```js // scan(seed: A, scanner: (A,B) => A): Stream var stream = Rafa.stream(); var values = []; stream.scan(0, (a,b) => a + b).each(v => values.push(v)); stream.enumerate(Rafa.Enumerator.array([1,2,3,4]); // values: [1,3,6,10]; ``` </aside>