On Apr 7, 6:06 pm, okuoku <
oku...@gmail.com> wrote:
> 2011/4/8 marcomaggi <
mrc....@gmail.com>:
> - snip -
>
> > Is this actually possible?
>
> Should not. In R6RS, DEFINE's at <body>s are syntactic sugar of letrec*
> (Seehttp://
www.r6rs.org/final/html/r6rs-rationale/r6rs-rationale-Z-H-13.h...
> )
> and they should evaluated in sequential-order.
If I am not mistaken: R6RS establishes only that the variables must be
bound to fresh locations first, then each variable is assigned left-to-
right; it does not enforce the order of evaluation of the init
expressions with the single exception of expressions which reference
bindings that follow. So reordering is possible when it is detected
by the expander that the order of side effects is the same, and has
been the subject of a paper:
"Fixing Letrec (reloaded)" by Abdulaziz Ghuloum , R. Kent Dybvig
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.159.4144
such transformation is indeed part of Ikarus's expander.
--
Marco Maggi