scan<I, O> static method

Conveyor<From<I>, O> scan<I, O>(
  1. O z,
  2. Function2<O, I, O> f
)

Implementation

static Conveyor<From<I>, O> scan<I, O>(O z, Function2<O, I, O> f) {
  Conveyor<From<I>, O> go(O previous) => consume((I i) {
    final current = f(previous, i);
    return produce(current, go(current));
  });
  return go(z);
}