Enum.uniq_by/2

defmodule Enum do
  def uniq_by(enumerable, fun)
end

Enumerates the enumerable by removing the elements for which function fun returned duplicate elements.

The function fun maps every element to a term. Two elements are considered duplicates if the return value of fun is equal for both of them.

The first occurrence of each element is kept.