A.Vector.update_at-exclamation-mark
You're seeing just the function
update_at-exclamation-mark
, go back to A.Vector module for more information.
Specs
Returns a copy of vector
with an updated value at the specified index
.
Raises an A.Vector.IndexError
if index
is out of bounds.
Supports negative indexing from the end of the vector
.
Runs in effective constant time.
Examples
iex> A.Vector.new(1..8) |> A.Vector.update_at!(2, &(&1 * 1000))
vec([1, 2, 3000, 4, 5, 6, 7, 8])
iex> A.Vector.new(1..8) |> A.Vector.update_at!(-1, &(&1 * 1000))
vec([1, 2, 3, 4, 5, 6, 7, 8000])
iex> A.Vector.new(1..8) |> A.Vector.update_at!(-9, &(&1 * 1000))
** (A.Vector.IndexError) out of bound index: -9 not in -8..7