You can do something like the following:
from toolz import take f = lambda seq: list(take(n, seq)) b.reduction(f, f)
This captures the first n elements of each section, collects them all together, and then takes the first n elements of the result.
Mocklin
source share