scsh-users
[Top] [All Lists]

Re: cons-streams and SCSH

To: scsh@martigny.ai.mit.edu
Subject: Re: cons-streams and SCSH
From: Sean Doran <smd@chops.icp.net>
Date: 22 Aug 1996 16:38:34 -0400
shivers@ai.mit.edu (Olin Shivers) writes:

> Actually, I had in mind something a little smaller. 

Oh.  :)

> By the way, Sean, the definition you are using for your stream datatype
> seems off. You check for termination by seeing if (STREAM-CAR S) is
> the empty stream, which isn't right. You may prefer the formulation I
> use below.

I actually went through Dybvig's 2e, and found 
(delay (cons a b)) rather than the (cons a (delay b))
found in SICP and Springer/Friedman.

I don't know what I prefer, frankly (apples & oranges from
my perspective -- clue me in here :) ), but with the 
(delay (cons a b)) form, I can't do this:

        (define factorials
          (stream-cons 1 (stream-times factorials positive-integers)))

without tripping off a recursive force.

For my current application, that's not terribly important,
though.

> with the second definition, the GC is able to reclaim
> the freed storage.

Yay, thanks for the interim workaround.  

        Sean.

<Prev in Thread] Current Thread [Next in Thread>