Enum.scan

You're seeing just the function scan, go back to Enum module for more information.

Specs

scan(t(), (element(), any() -> any())) :: list()

Applies the given function to each element in the enumerable, storing the result in a list and passing it as the accumulator for the next computation. Uses the first element in the enumerable as the starting value.

Examples

iex> Enum.scan(1..5, &(&1 + &2))
[1, 3, 6, 10, 15]
Link to this function

scan(enumerable, acc, fun)

View Source

Specs

scan(t(), any(), (element(), any() -> any())) :: list()

Applies the given function to each element in the enumerable, storing the result in a list and passing it as the accumulator for the next computation. Uses the given acc as the starting value.

Examples

iex> Enum.scan(1..5, 0, &(&1 + &2))
[1, 3, 6, 10, 15]