Stream.transform/3

defmodule Stream do
  def transform(stream, acc, fun)
end

Transforms an existing stream.

It expects an accumulator and a function that receives each stream element and an accumulator. It must return a tuple, where the first element is a new stream (often a list) or the atom :halt, and the second element is the accumulator to be used by the next element, if any, in both cases.