(stream-cons (1) stream-null) => stream David Van Horn (10 Nov 2006 23:38 UTC)
Re: (stream-cons (1) stream-null) => stream David Van Horn (10 Nov 2006 23:46 UTC)
Re: (stream-cons (1) stream-null) => stream AndrevanTonder (11 Nov 2006 00:41 UTC)
Re: (stream-cons (1) stream-null) => stream David Van Horn (11 Nov 2006 01:03 UTC)
Re: (stream-cons (1) stream-null) => stream AndrevanTonder (11 Nov 2006 12:32 UTC)
Re: (stream-cons (1) stream-null) => stream David Van Horn (11 Nov 2006 02:21 UTC)
Re: (stream-cons (1) stream-null) => stream AndrevanTonder (11 Nov 2006 14:19 UTC)

Re: (stream-cons (1) stream-null) => stream AndrevanTonder 11 Nov 2006 00:37 UTC

On Fri, 10 Nov 2006, David Van Horn wrote:

> David Van Horn wrote:
>
>    (stream-cdr (stream-cons (1) stream-null))
>
> Which should evaluate to a stream ...

I do not think this statement is necessarily correct.  I believe it is
legitimate for this to give the error it currently does.

In other words, I think it is legitimate to define the stream abstraction
to be

   (stream-cons exp1 exp2) = (delay (cons exp1 exp2))

which is essentially how the current implementation does it, if I
remember correctly.  Your alternative abstraction would correspond to

   (stream-cons exp1 exp2) = (delay (cons (delay exp1) exp2)),

although if you want to be consistent, you should also delay exp2.
This is not illegitimate, but the extra laziness is really orthogonal to
the abstraction.  It can be added by hand when desired, as in

   (stream-cdr (stream-cons (delay (1)) stream-null))

independently of the basic machinery provided to manipulate the stream-part
of the abstraction.

Cheere
Andre