I’m working with Flow, but I’m having trouble understanding how departitioning works. I have no mental model about how this last step really works. I understand that everything is forced back into one process. But it’s unclear to me where this step really belongs: does it add a new layer, or does the departition step belongs to the previous layer?
It seems that the
:window option on Flow.departition/5 itself has no impact on how the departition step emits values. The
:window option of the previous
Flow.partition/2 call (or any function that adds a layer that accepts a
:window option) does have impact on how values are emitted after departitioning.
The end-game I’m after is being able to stream values that were emitted from the last departitioning step into the current process. This is now possible with the Flow.stream/2 function that was recently added (thank you José! ). I do understand the examples given with the departition function. But it just doesn’t click enough to understand how to go from there.
More in general I’m having trouble building a mental model about the concept of layers (with its stages) in the flow library. That would be my only remark until now. It’s only after some days working with Flow, that I’ve come to understand what the actual seams really are and how the layers of processes are being built. Maybe that’s considered an implementation detail, but it’s a leaky abstraction when I want to understand how departition works for example. It also is somewhat required to understand when you consider that not all steps are allowed after each other (for example, mapping after reducing now raises a warning and is considered bad practice).
Grateful for any insights!