Single-step transducer execution wrapper. Returns array if transducer produces multiple results and undefined if there was no output. Else returns single result value.
remarks
Likewise, once a transducer has produced a final / reduced value, all further invocations of the stepper function will return undefined.
example
// single result
step(map(x => x * 10))(1);
// 10// multiple results
step(mapcat(x => [x, x + 1, x + 2]))(1)
// [ 1, 2, 3 ]// no result
f = step(filter((x) => !(x & 1)))
f(1); // undefined
f(2); // 2// reduced value termination
f = step(take(2));
f(1); // 1
f(1); // 1
f(1); // undefined
f(1); // undefined
Single-step transducer execution wrapper. Returns array if transducer produces multiple results and undefined if there was no output. Else returns single result value.
Likewise, once a transducer has produced a final / reduced value, all further invocations of the stepper function will return undefined.
// single result step(map(x => x * 10))(1); // 10 // multiple results step(mapcat(x => [x, x + 1, x + 2]))(1) // [ 1, 2, 3 ] // no result f = step(filter((x) => !(x & 1))) f(1); // undefined f(2); // 2 // reduced value termination f = step(take(2)); f(1); // 1 f(1); // 1 f(1); // undefined f(1); // undefined