chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] letrec expansion


From: Dan Muresan
Subject: [Chicken-users] letrec expansion
Date: Sun, 26 Nov 2006 15:42:39 +0200

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]