A.Vector.at

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

Specs

at(t(val), index()) :: val | nil when val: value()

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

Returns default 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(1_000)
nil
Link to this function

at(vector, index, default)

View Source

Specs

at(t(val), index(), default) :: val | default when val: value(), default: term()