[racket] Racket letrec versus R5RS and R6RS letrec and letrec*
At Sun, 18 Dec 2011 09:14:00 -0500, Harry Spier wrote:
> I saw on another list (Stack Overflow) a comment that Racket letrec
> was equivalent to R5RS and R6RS letrec*, but when I checked the Racket
> reference manual section 2.9 I didn't see any mention of strict left
> to right evaluation.
> ---------------------------------------------
> (letrec ([id val-expr] ...) body ...+)
>
> Similar to let, but the locations for all ids are created first and
> filled with #<undefined>, and all ids are bound in all val-exprs as
> well as the bodys. The ids must be distinct according to
> bound-identifier=?.
> -------------------------------------------
>
> 1.) Can someone verify for me whether Racket letrec is equivalent to
> RnRS letrec* or to RnRS letrec.
"Similar to let" is meant to imply left-to-right evaluation, but I'll
adjust the docs to clarify.
> 2) Also how in Racket do you set an id to #<undefined> . I was unable
> to find an (undefined) function returning #<undefined> similar to
> (void) returning #<void> .
There isn't one, but you can write
(define (undefined) (letrec ([x x]) x))