A.Vector.at-exclamation-mark

You're seeing just the function at-exclamation-mark, go back to A.Vector module for more information.

Specs

at!(t(val), index()) :: val when val: value()

Finds the element at the given index (zero-based).

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..1_000) |> A.Vector.at!(555)
556
iex> A.Vector.new(1..1_000) |> A.Vector.at!(-10)
991
iex> A.Vector.new(1..1_000) |> A.Vector.at!(1_000)
** (A.Vector.IndexError) out of bound index: 1000 not in -1000..999