Stream.unfold/2
defmodule Stream do
def unfold(acc, fun)
end
Emits a sequence of values for the given accumulator acc
.
Successive values are generated by calling fun
with the previous accumulator and it must return a tuple with the current value and next accumulator. The enumeration finishes if it returns nil
.