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

From: Eugene Toder (eltoder at gmail.com)
Date: Sat Mar 5 15:36:58 EST 2011

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


Posted on the users mailing list.