Enum.dedup_by/2

defmodule Enum do
  def dedup_by(enumerable, fun)
end

Discards all those adjacent elements in enumerable which are duplicated in terms of the output of the fun function, collapsing them in a single element.