In addition to let, let*, and letrec, MzScheme supports letrec*, which is similar to a letrec expression. In letrec* expression, the local variable expressions are sequentially evaluated and assigned to variables using the order of the variable declarations. Every letrec expression can be legally replaced with a letrec* expression, since the order of evaluation for letrec is undefined.
When a letrec or letrec* expression is evaluated, the new
local variables are initially assigned the special value
#<undefined>. For example:
(letrec* ([x y] [y 5]) x) ; => #<undefined>
When a define statement is embedded in a closure, it is transformed into a letrec* statement where the remainder of the closure (i.e., the statements following the define) are moved to the body of the letrec*. Multiple adjacent define statements are collected into a single letrec* transformation. Two define expressions in a closure body are not mutually recursive if the expressions are separated by a non-define expression.