Tue Dec 8 01:16:10 CET 2009
Erlang documentation gives the following definition for lazy
[N | ints_from(N+1)]
I tried to implement basic operations like map, filter and fold using
this function, and it was quite hard. On one the forums I found
another definition (by Joe Armstrong, I believe):
ints_from(K) -> [K | fun() -> ints_from(K+1) end].
With that one it's much easier to implement the functions above (at
least for me). I'm wondering if anybody uses the first definition, and
how map/filter/fold should look like then? What benefits does the
first definition give us in comparison to the second one?
More information about the erlang-questions