Enum.with_index

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

with_index(enumerable, fun_or_offset \\ 0)

View Source

Specs

with_index(t(), integer()) :: [{term(), integer()}]
with_index(t(), (element(), index() -> value)) :: [value] when value: any()

Returns the enumerable with each element wrapped in a tuple alongside its index.

May receive a function or an integer offset.

If an offset is given, it will index from the given offset instead of from zero.

If a function is given, it will index by invoking the function for each element and index (zero-based) of the enumerable.

Examples

iex> Enum.with_index([:a, :b, :c])
[a: 0, b: 1, c: 2]

iex> Enum.with_index([:a, :b, :c], 3)
[a: 3, b: 4, c: 5]

iex> Enum.with_index([:a, :b, :c], fn element, index -> {index, element} end)
[{0, :a}, {1, :b}, {2, :c}]