letrec
Schemeでは次のような式はエラーになることを初めて知った。
(let ((x (+ x 1))) x)
(+ x 1) の x が未定義になるため。
R5RSによると,letrecの意味は
library syntax: (letrec
)
Syntax:
should have the form
((
) ...),
and
should be a sequence of one or more expressions. It is an error for ato appear more than once in the list of variables being bound.
Semantics: The
Revised^5 Report on the Algorithmic Language Schemes are bound to fresh locations holding undefined values, the s are evaluated in the resulting environment (in some unspecified order), each is assigned to the result of the corresponding , the is evaluated in the resulting environment, and the value(s) of the last expression in is(are) returned. Each binding of a has the entire letrec expression as its region, making it possible to define mutually recursive procedures.
となっている。