[plt-scheme] why isn't DrScheme odd enough?
[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)
l
(cons (f (car l))
(delay (dmap f (force (cdr l)))))))
(define (cutoff n l)
(cond
((= 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?
Shriram
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!