Skip to content

Commit 2949693

Browse files
author
José Valim
committed
Improve docs for chunk_by/4
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent 9971276 commit 2949693

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/elixir/lib/enum.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,15 @@ defmodule Enum do
374374
end
375375

376376
@doc """
377-
Splits enumerable on every element for which `fun` returns a new
378-
value.
377+
Chunks the `enum` with fine grained control when every chunk is emitted.
378+
379+
`chunk_fun` receives the current element and the accumulator and
380+
must return `{:cont, element, acc}` to emit the given chunk and
381+
continue with accumulator or `{:cont, acc}` to not emit any chunk
382+
and continue with the return accumulator.
383+
384+
`after_fun` is invoked when iteration is done and must also return
385+
`{:cont, element, acc}` or `{:cont, acc}`.
379386
380387
Returns a list of lists.
381388

0 commit comments

Comments
 (0)