A.Vector.drop

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

Specs

drop(t(val), integer()) :: t(val) when val: value()

Drops the amount of elements from the vector.

If a negative amount is given, the amount of last values will be dropped.

Time complexity is:

  • linear when amount is positive, as the vector needs to be reconstructed.
  • effective constant time when amount is negative, as the vector structure can be shared

Examples

iex> A.Vector.new(0..15) |> A.Vector.drop(10)
vec([10, 11, 12, 13, 14, 15])
iex> A.Vector.new(0..5) |> A.Vector.drop(0)
vec([0, 1, 2, 3, 4, 5])
iex> A.Vector.new(0..10) |> A.Vector.drop(-5)
vec([0, 1, 2, 3, 4, 5])