buffer<A> static method
Implementation
static Conveyor<From<A>, A> buffer<A>(Monoid<A> monoid, int n) {
Conveyor<From<A>, A> go(int i, A sofar) =>
consume(
(a) => i > 1 ? go(i-1, monoid.append(sofar, a)) : produce(monoid.append(sofar, a), go(n, monoid.zero()))
,() => sofar == monoid.zero() ? halt() : produce(sofar));
return go(n, monoid.zero());
}