seeking more explanation on ex 3.40

78 views
Skip to first unread message

Javran Cheng

unread,
Feb 2, 2014, 3:19:20 AM2/2/14
to eo...@googlegroups.com
Hi,

I'm working on ex 3.40 but can't following the suggestion in exercise:

First I changed the representation of `senv` to make it keep track of whether it was bound by `letrec` or not (by tying every var with an extra bool value).

Then in `(var-exp (var)` of `translation-of`, I look at that bool value and translate `var-exp` into either `nameless-var-exp` or `nameless-letrec-var-exp`.

But soon as I start working to make the interpreter work, I realized I couldn't do the right things when dealing with `nameless-letrec-var-exp` but keep rest of the program intact,

because as the `value-of` reaches a nameless-letrec-exp, the environment doesn't contain the procedure we needed inside.

I can implement `letrec` by allowing the nameless-environment to store vectors to break the env-proc cycle dependency, but just don't follow the instructions in book.

Thanks.



Yukang Chen

unread,
Jul 29, 2014, 11:15:21 PM7/29/14
to eo...@googlegroups.com

Hi, 

I implemented it like this, hope it's helpful.
Reply all
Reply to author
Forward
0 new messages