Stream.chunk_every
You're seeing just the function
chunk_every, go back to Stream module for more information.
Specs
chunk_every(Enumerable.t(), pos_integer()) :: Enumerable.t()
Shortcut to chunk_every(enum, count, count).
Specs
chunk_every( Enumerable.t(), pos_integer(), pos_integer(), Enumerable.t() | :discard ) :: Enumerable.t()
Streams the enumerable in chunks, containing count elements each,
where each new chunk starts step elements into the enumerable.
step is optional and, if not passed, defaults to count, i.e.
chunks do not overlap.
If the last chunk does not have count elements to fill the chunk,
elements are taken from leftover to fill in the chunk. If leftover
does not have enough elements to fill the chunk, then a partial chunk
is returned with less than count elements.
If :discard is given in leftover, the last chunk is discarded
unless it has exactly count elements.
Examples
iex> Stream.chunk_every([1, 2, 3, 4, 5, 6], 2) |> Enum.to_list()
[[1, 2], [3, 4], [5, 6]]
iex> Stream.chunk_every([1, 2, 3, 4, 5, 6], 3, 2, :discard) |> Enum.to_list()
[[1, 2, 3], [3, 4, 5]]
iex> Stream.chunk_every([1, 2, 3, 4, 5, 6], 3, 2, [7]) |> Enum.to_list()
[[1, 2, 3], [3, 4, 5], [5, 6, 7]]
iex> Stream.chunk_every([1, 2, 3, 4, 5, 6], 3, 3, []) |> Enum.to_list()
[[1, 2, 3], [4, 5, 6]]