pantomime-rs / pantomime

MIT License
5 stars 1 forks source link

streams: Implement Fold, and fix a bug in Fused #76

Closed longshorej closed 4 years ago

longshorej commented 4 years ago

This implements fold, which is initialized with an initial state and a function that takes the current state and next element, outputting the next state.

Unlike scan, fold does not emit each state downstream, instead only emitting a single element when upstream completes.

Additionally, this fixes a bug in Fused where logic could receive events even after they emitted a stopped action.