Arc Forumnew | comments | leaders | submitlogin
1 point by cchooper 6151 days ago | link | parent

letrec won't work for non-function definitions, for example:

  (letrec ((x 5)
           (y x))
    y)
For this, you need let-star (not sure how to write that in markdown), but let-star doesn't give you forward reference, so nothing is quite right.


5 points by shiro 6151 days ago | link

Oh, if you want that, check out letrec*.

http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_id...

-----

1 point by cchooper 6151 days ago | link

That's it, perfectly!

-----

4 points by pg 6150 days ago | link

You can just write let* so long as there is a space after the asterisk.

-----

1 point by cchooper 6150 days ago | link

Ah, the problem was I had a comma after it. Thanks.

-----

1 point by andreyf 5839 days ago | link

let*, huh?

-----