Sliding Windows in Streams

Hi guys,

most of the time when I need to process the stream with sliding windows, I use the Enum.reduce function to accumulate the values I need to process together. I didn’t find any stream sliding function in the elixir standard library.
I’ve found the flow project though, and it seems to give much more advanced options on streams. Anyone knows if flow is considered just a side project or an active part of the elixir ecosystem?
I think that features like sliding windows should be something part of a functional language.

Anyone here using different functions or patterns to do that?

thanks

It’s active, made by the elixir devs themselves. It was considered to be brought into Core but it is not ‘universally’ useful for everyone and not needed for Elixir itself so it was kept as a side library.

2 Likes

The main function to obtain a sliding window is Stream.chunk_every(enum, count, step, leftover \\ []). Documentation.

6 Likes