List.update_at

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

update_at(list, index, fun)

View Source

Specs

update_at([elem], integer(), (elem -> any())) :: list() when elem: var

Returns a list with an updated value at the specified index.

Negative indices indicate an offset from the end of the list. If index is out of bounds, the original list is returned.

Examples

iex> List.update_at([1, 2, 3], 0, &(&1 + 10))
[11, 2, 3]

iex> List.update_at([1, 2, 3], 10, &(&1 + 10))
[1, 2, 3]

iex> List.update_at([1, 2, 3], -1, &(&1 + 10))
[1, 2, 13]

iex> List.update_at([1, 2, 3], -10, &(&1 + 10))
[1, 2, 3]