-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Testcase:
//crashes
Stream(1,2,3) ++ Stream.fail("X")).transduce(ZTransducer.collectAllN(3)).take(1).runCollect
Why it happens:
collectAllN relies on foldWeightedDecompose.
When weight reaches 3, it doesn't emit an element immediately but rather waits until weight becomes strictly bigger.
I tried to change foldWeightedDecompose to terminate earlier but it breaks collectAllSetN.
Why it is important:
I'm working on Transducer#race family of combinators.
Racing transducers in the presence of chunking could lead to very surprising results.
When a single transducer emits at unexpected moment, this makes things even worse.
It could be fixed by adding a flag to foldWeightedDecompose whether it should terminate early.
Or alternatively, by stopping digging the hole and implementing collectAllN separately.
@iravid WDYT?
Metadata
Metadata
Assignees
Labels
No labels