[plt-scheme] why isn't DrScheme odd enough?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Sep 19 12:11:35 EDT 2007

[Forwarded for Shriram, who mailed this to the wrong address]

On Sep 19, Shriram Krishnamurthi wrote:
According to the Wadler/Taha/MacQueen paper on even and odd lazy
lists, the following program should produce an error:

(define (countdown n)
  (cons n (delay (countdown (- n 1)))))

(define (dmap f l)
  (if (null? l)
      (cons (f (car l))
            (delay (dmap f (force (cdr l)))))))

(define (cutoff n l)
    ((= n 0) '())
    ((null? l) '())
    (else (cons (car l)
                (cutoff (- n 1) (force (cdr l)))))))

(cutoff 5 (dmap sqrt (countdown 4)))

In fact, it does no such thing.  I wondered whether DrScheme had
adopted "even" laziness somewhere along the way, so I switched to R5RS
Scheme (hence the lack of brackets, etc., above) and ditto.

Anyone spot what I'm missing?


          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.