[erlang-questions] generators/iterators

Damien Morton <>
Sat Jun 16 22:16:45 CEST 2007


Hmm,

Coming from a strong Python and C# background, I find myself missing 
generators/iterators.

For example, when using list comprehension syntax, I find myself wanting 
to use a function as a generator

items(X) ->
    fun() -> next_item(X) end.

[Y*Y || Y <- items(X)]

Would it be simple to have erlang recognise a function as a generator?

Sorry if the terminology is getting mixed up here.



More information about the erlang-questions mailing list