[racket] stream-cons from racket/stream isn't lazy

From: Jos Koot (jos.koot at telefonica.net)
Date: Sat Mar 5 16:05:01 EST 2011

+1,
this behaviour of stream-cons of racket/stream definitely is wrong.
Jos

> -----Original Message-----
> From: users-bounces at racket-lang.org 
> [mailto:users-bounces at racket-lang.org] On Behalf Of Eugene Toder
> Sent: 05 March 2011 21:37
> To: users at racket-lang.org
> Subject: [racket] stream-cons from racket/stream isn't lazy
> 
> Hello,
> 
> stream-cons from racket's standard racket/stream.rkt is implemented as
> a macro -stream-cons wrapped into a case-lambda.
> This wrapping makes it strict in both arguments, contrary to the
> traditional behaviour from SICP, srfi-40, srfi-41 etc.
> For example:
> 
> > (define (foo) (display "called\n") empty-stream)
> > (stream-cons 1 (foo))
> called
> #<sequence>
> > (require srfi/41)
> > (stream-cons 1 (foo))
> #<stream>
> 
> Is this intentional? Is there a way to get traditional lazy behaviour
> other than by implementing it with make-do-sequence or generator?
> 
> Eugene
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.