Enumerable.reduce

You're seeing just the function reduce, go back to Enumerable module for more information.
Link to this function

reduce(enumerable, acc, fun)

View Source

Specs

reduce(t(), acc(), reducer()) :: result()

Reduces the enumerable into an element.

Most of the operations in Enum are implemented in terms of reduce. This function should apply the given reducer/0 function to each element in the enumerable and proceed as expected by the returned accumulator.

See the documentation of the types result/0 and acc/0 for more information.

Examples

As an example, here is the implementation of reduce for lists:

def reduce(_list, {:halt, acc}, _fun), do: {:halted, acc}
def reduce(list, {:suspend, acc}, fun), do: {:suspended, acc, &reduce(list, &1, fun)}
def reduce([], {:cont, acc}, _fun), do: {:done, acc}
def reduce([head | tail], {:cont, acc}, fun), do: reduce(tail, fun.(head, acc), fun)