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.
|