Hi,

I've noticed that letrec seems to have a problematic expansion. I'm
not sure if this has been discussed before (I couldn't find any
matches):

csi> (macroexpand '(letrec ((x 1)) x))
(let ((g1312 (##core#undefined))) (begin (##core#set! g1312 (quote 1)) g1312))

This definition doesn't use temporaries -- as, for example, in the
standard R5RS syntax-rules definition of letrec,

http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-10.html#%_sec_7.3

Without using temporaries, some call/cc + letrec combinations don't work:

(letrec ((x (call/cc list)) (y (call/cc list)))
 (if (procedure? x) (x (pair? y)))
 (if (procedure? y) (y (pair? x)))
 (let ((xk (car x)) (yk (car y)))
   (and (call/cc xk) (call/cc yk) (call/cc xk))))

csi produces #f, while SISC, Scheme48 and guile correctly output #t.
Thanks go to Al Petrofsky for describing the problem.

Dan Muresan
http://alumnus.caltech.edu/~muresan/


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to