On Tue, Apr 11, 2006 at 01:46:05PM +0200, felix winkelmann wrote:
> On 4/10/06, Dan <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > After reading the SRFI-40 (stream library) egg
> > documentation at
> >
> > http://www.call-with-current-continuation.org/eggs/srfi-40.html
> >
> > I thought that the implementation includes the srfi-45
> > fixes to avoid space leaks. However, the test program
> > below seems to take up an ever-increasing amount of
> > memory. What gives?
> >
> 
> Hm. I don't use streams much, but since you are referencing
> the 5-gazillionth element, you probably have to build the
> list up to that element, or not?

He is looping through the elements with a tail-recursive function.
This should not pose any problems, since only the car of the list needs
to be forced, after which it is discarded and recursion takes place on
the cdr.

I don't completely understand everything in SRFI-45, but it looks like
the implementation of stream-unfoldn (used by stream-filter) should use
lazy instead of delay?

If I understand correctly, delay and force are not "fixed" by SRFI-45, but
the algorithm of converting a program to a lazy version of the program is
"fixed" by requiring lazy instead of delay.

HTH,
Peter
-- 
http://www.student.ru.nl/peter.bex
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpwFB9tXahwJ.pgp
Description: PGP signature

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to