[racket] Lazy take is the identity?

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed Jan 26 15:20:19 EST 2011

On Wed, Jan 26, 2011 at 2:41 PM, John Clements
<clements at brinckerhoff.org> wrote:
> Correct me if I'm wrong, but this appears to be a different issue.  The question here is not laziness, but the length of the resulting list.  Here's another example:
> #lang lazy
> (define zeros (cons 0 zeros))
> (define lazy-list-of-length-one (take 1 zeros))
> (define should-be-null (rest lazy-list-of-length-one))
> =>
> Welcome to DrRacket, version [3m].
> Language: lazy [custom]; memory limit: 256 MB.
>> (! should-be-null)
> '(0 . #<promise:...llects/lazy/lazy.rkt:588:41>)

Yes, I believe you've found a bug. When lazy-take was updated to fix
the bug pointed out by Casey, one of the legitimate combination of
arguments (n = 0, lst = non-null) was accidentally dropped. I just
tested an older version and your code works. I'm fixing it now.

Welcome to DrRacket, version [3m].
Language: Lazy Racket [custom].
> should-be-null

Posted on the users mailing list.