R5RS provides suggested macro definitions for syntax library forms:
http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-ZH-10.html#%_sec_7.3
Which also defines letrec, in a very complex way, of course, not the way I would define it, I would simply use:
(define-syntax letrec2
(syntax-rules ()
((letrec2 ((name val) ...) body bodies ...)
((lambda ()
(define name val) ...
body bodies ...)))))
As far as I understand the semantics of letrec, which I use very often as a named let. It works this way, however, since I had my share of debates with philosophers who think they can simply refute the special theory of relativity or established phonological theories, I know that when you think that you have a simple solution to a complex problem, possibly WRONG. There must be some time when this macro does not satisfy the semantics of letrec else, which they probably would use.
In this definition, the definitions are local to the letrec body, they can refer to each other for mutual recursion, I'm not quite sure what (if any) is wrong.
Zorf source
share