Streams implementation in Erlang