Stream.chunk_by/2

defmodule Stream do
  def chunk_by(stream, fun)
end

Chunks stream by buffering elements for which fun returns the same value.

Elements are only emitted when fun returns a new value or the enumerable finishes.