Hi,
I've been meaning to read this article, finally did, and it was full of insights.
I discovered a few minor issues.
the resulting array as a comment:
// Replicate Array.map()
transduce(mul10, push(), null, [1, 2, 3, 4]);
// [10, 20, 30, 40]
same here:
// overlaps can be achieved via optional step size
tx.transduce(tx.partition(3, 1), tx.push(), tx.range(10));
// [
// [0, 1, 2],
// [1, 2, 3],
// [2, 3, 4],
// [3, 4, 5],
// [4, 5, 6],
// [5, 6, 7],
// [6, 7, 8],
// [7, 8, 9],
// ]
update converge
condition from 1e-3
to 1
:
// leaky integrator which stops when difference between
// prev/curr goes below 1
[
...tx.converge(
(a, b) => Math.abs(a - b) < 1,
tx.iterate((x) => x + (100 - x) * 0.5, 0)
),
];