Lazy lists - an implementation.

Sean Hinde Sean.Hinde@REDACTED
Tue Oct 17 20:08:56 CEST 2000


Hi,

> > OK, since noone complained too much, here's a hack of lists.erl,
> > where most functions have been enhanced to operate on both eager
> > and lazy lists.
> 
> And here is my first version of a lazy lists library. Seems 
> to work ok.

Just so I (and I guess others?) understand how all this would be applied to
the original problem (that iterating over very large lists causes large
heaps to be generated)..

If we already have a large list and want to generate another I guess there
would there be no benefit of converting this into a lazy_list first? (would
this make a Huge fun?)

If we already have the list and want to do say a checksum calc on it
(foreach/2) there is no advantage because we still have to run through all
the elements (ok, one at a time)?

So this could be used where the list itself doesn't already exist and we
want to iterate to produce a result which isn't a list? Wouldn't the stack
then fill up with the not yet calculated results of each iteration?

My head is starting to spin. Under what circumstances would this stuff be
very appropriate to use?

Thanks for the code BTW - wow,

Sean



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.





More information about the erlang-questions mailing list