[erlang-questions] generators/iterators

Mike McNally m5@REDACTED
Mon Jun 18 02:13:33 CEST 2007

> Umm, I just realised that a stream/generator would need to be a function 
> that returns a function that can be called repeatedly to generate the 
> sequence, probably terminating with a well-known sequence terminating 
> exception.
> This would solve the problem of the generators needing to be reset 
> during nested loops in a comprehension.

Can somebody explain why it is that you wouldn't do such things with an
Erlang process instead of something like what you describe here? The
main issue with processes, as far as I've been able to determine by just
thinking about it, is that they don't really get "garbage collected" so
your code can't just forget about them like generators in other
languages (or like funs in Erlang).

[ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED

More information about the erlang-questions mailing list