Stream.dedup_by/2

defmodule Stream do
  def dedup_by(stream, fun)
end

Creates a stream that only emits elements if the result of calling fun on the element is different from the (stored) result of calling fun on the last emitted element.