Enum.reduce_while
You're seeing just the function
reduce_while, go back to Enum module for more information.
Specs
Reduces enumerable until fun returns {:halt, term}.
The return value for fun is expected to be
{:cont, acc}to continue the reduction withaccas the new accumulator or{:halt, acc}to halt the reduction
If fun returns {:halt, acc} the reduction is halted and the function
returns acc. Otherwise, if the enumerable is exhausted, the function returns
the accumulator of the last {:cont, acc}.
Examples
iex> Enum.reduce_while(1..100, 0, fn x, acc ->
...> if x < 5, do: {:cont, acc + x}, else: {:halt, acc}
...> end)
10
iex> Enum.reduce_while(1..100, 0, fn x, acc ->
...> if x > 0, do: {:cont, acc + x}, else: {:halt, acc}
...> end)
5050