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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Mar 5 17:11:01 EST 2011

Consider using Lazy Racket. -- Matthias



On Mar 5, 2011, at 3:36 PM, Eugene Toder wrote:

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