A.Vector.dedup_by
You're seeing just the function
dedup_by
, go back to A.Vector module for more information.
Specs
Returns a copy of the vector
where all consecutive duplicated elements are collapsed to a single element.
The function fun
maps every element to a term which is used to determine if two elements are duplicates.
Examples
iex> vector = A.Vector.new([{1, :a}, {2, :b}, {2, :c}, {1, :a}])
iex> A.Vector.dedup_by(vector, fn {x, _} -> x end)
vec([{1, :a}, {2, :b}, {1, :a}])
iex> vector = A.Vector.new([5, 1, 2, 3, 2, 1])
iex> A.Vector.dedup_by(vector, fn x -> x > 2 end)
vec([5, 1, 3, 2])