Stream-filter and space leaks Phil Bewig (20 Feb 2003 14:08 UTC)
Re: Stream-filter and space leaks Richard Kelsey (20 Feb 2003 18:41 UTC)
Re: Stream-filter and space leaks Phil Bewig (21 Feb 2003 09:57 UTC)
Re: Stream-filter and space leaks Richard Kelsey (21 Feb 2003 23:18 UTC)
Re: Stream-filter and space leaks sperber@xxxxxx (21 Feb 2003 10:04 UTC)
Re: Stream-filter and space leaks Richard Kelsey (21 Feb 2003 15:06 UTC)
Re: Stream-filter and space leaks Matthias Neubauer (25 Feb 2003 16:01 UTC)
Re: Stream-filter and space leaks Richard Kelsey (25 Feb 2003 18:25 UTC)
Re: Stream-filter and space leaks Matthias Neubauer (25 Feb 2003 21:32 UTC)
Re: Stream-filter and space leaks Richard Kelsey (25 Feb 2003 22:11 UTC)
Re: Stream-filter and space leaks sperber@xxxxxx (26 Feb 2003 08:18 UTC)
Re: Stream-filter and space leaks Matthias Neubauer (26 Feb 2003 13:31 UTC)
Re: Stream-filter and space leaks sperber@xxxxxx (11 Mar 2003 14:58 UTC)
Re: Stream-filter and space leaks Matthias Neubauer (19 Mar 2003 15:27 UTC)
Re: Stream-filter and space leaks felix (22 Mar 2003 09:49 UTC)
Re: Stream-filter and space leaks felix (22 Mar 2003 09:56 UTC)

Re: Stream-filter and space leaks Matthias Neubauer 26 Feb 2003 13:31 UTC

xxxxxx@informatik.uni-tuebingen.de (Michael Sperber [Mr.  Preprocessor]) writes:

> >>>>> "Matze" == Matthias Neubauer <xxxxxx@informatik.uni-freiburg.de> writes:
>
> Matze> Richard Kelsey <xxxxxx@s48.org> writes:
>
> >> Our different experiences may be based on differences between the 0.57 and
> >> the Scheme 48 version underlying Scsh 0.6.3.  I don't know which version
> >> that is.
>
> Matze> Well, that's what I already feared. To me, this means either that my
> Matze> scsh is somehow "buggy" or that we still don't have a portable,
> Matze> non-leaking implementation of STREAM-FILTER.
>
> There's no way to do that in general.  However, if you take the code
> Phil posted last and lambda-lift the internal definitions out, you'll
> get something that works pretty much everywhere (certainly in Scheme
> 48 and scsh), I conjecture.

Yes, this does the trick. After lambda-lifting STREAM-FILTER,

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

also loops in my scsh.

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

   (define (filter-zero stream)
     (stream-filter (lambda (x) (zero? x))
                    stream))

   (stream-car (filter-zero (stream-from 1)))

in scsh, I will again see a space leak.

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

-Matthias

--
Matthias Neubauer                                       |
Universität Freiburg, Institut für Informatik           | tel +49 761 203 8060
Georges-Köhler-Allee 79, 79110 Freiburg i. Br., Germany | fax +49 761 203 8052