Enum.dedup_by
You're seeing just the function
dedup_by
, go back to Enum module for more information.
Specs
Enumerates the enumerable
, returning a list 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> Enum.dedup_by([{1, :a}, {2, :b}, {2, :c}, {1, :a}], fn {x, _} -> x end)
[{1, :a}, {2, :b}, {1, :a}]
iex> Enum.dedup_by([5, 1, 2, 3, 2, 1], fn x -> x > 2 end)
[5, 1, 3, 2]