scanWhile<I, O> static method

Conveyor<From<I>, O> scanWhile<I, O>(
  1. O z,
  2. Function2<O, I, O> f,
  3. Function1<O, bool> p
)

Implementation

static Conveyor<From<I>, O> scanWhile<I, O>(O z, Function2<O, I, O> f, Function1<O, bool> p) {
  Conveyor<From<I>, O> go(O previous) => consume((I i) {
    final current = f(previous, i);
    return produce(current, p(current) ? go(current) : halt());
  });
  return go(z);
}