A.Vector.slice
You're seeing just the function
slice
, go back to A.Vector module for more information.
Specs
Returns a subset of the given vector
by index_range
.
Works the same as Enum.slice/2
, see its documentation for more details.
Runs in linear time regarding the size of the returned subset.
Examples
iex> A.Vector.new(0..100) |> A.Vector.slice(80..90)
vec([80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90])
iex> A.Vector.new(0..100) |> A.Vector.slice(-40..-30)
vec([61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71])
iex> A.Vector.new([:only_one]) |> A.Vector.slice(0..1000)
vec([:only_one])
Specs
slice(t(val), index(), non_neg_integer()) :: t(val) when val: value()
Returns a subset of the given vector
, from start_index
(zero-based)
with amount number
of elements if available.
Works the same as Enum.slice/3
, see its documentation for more details.
Runs in linear time regarding the size of the returned subset.
Examples
iex> A.Vector.new(0..100) |> A.Vector.slice(80, 10)
vec([80, 81, 82, 83, 84, 85, 86, 87, 88, 89])
iex> A.Vector.new(0..100) |> A.Vector.slice(-40, 10)
vec([61, 62, 63, 64, 65, 66, 67, 68, 69, 70])
iex> A.Vector.new([:only_one]) |> A.Vector.slice(0, 1000)
vec([:only_one])