[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stream-filter and space leaks

This page is part of the web mail archives of SRFI 40 from before July 7th, 2015. The new archives for SRFI 40 contain all messages, not just those from before July 7th, 2015.

>>>>> "Matze" == Matthias Neubauer <neubauer@xxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

Matze> The real problem is see is the following: as soon as I apply some kind
Matze> of abstraction over STREAM-FILTER---which is something every Schemer
Matze> wants to do of course---, hell breaks loose again. E.g., if I type 

Matze>    (define (filter-zero stream)
Matze>      (stream-filter (lambda (x) (zero? x)) 
Matze>                     stream))
Matze>    (stream-car (filter-zero (stream-from 1)))

Matze> in scsh, I will again see a space leak.

Matze> Considering all the major Scheme implementations, how common is it to
Matze> use a flat closure representation for procedures?

This won't be solved by flat closures---the call to FILTER-ZERO is a
non-tail call, and it'd be necessary to mark dead variables in
continuation frames to make this not leak.  There's provision for
doing that in Scheme 48, but a compiler which exploits it is still in
the works.  (That specific part is functional, though.)

Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla