the 11th homework assignment

vaidas
Mausschubser
Beiträge: 65
Registriert: 4. Feb 2010 17:12

the 11th homework assignment

The last homework assignment is online:

Vaidas

citta
Mausschubser
Beiträge: 96
Registriert: 7. Nov 2006 21:52

Re: the 11th homework assignment

In task 2.2, can we assume that the body in a rec is always a function application of the bound-expr of that rec?

MisterD123
Geek
Beiträge: 811
Registriert: 31. Okt 2006 20:04

Re: the 11th homework assignment

i dont think you should do that.. ;P

as you seem to have noticed the language is missing the with construct, to which one would attempt to map the rec construct, with a "specific binding". However, you can fake a with statement through function application: (with (x y) z) === (app (fun (x) z) y). You can think of "execute z with the value y bound to x", which is done in both these variants. And that does work with anything, not just with function applications. So this actually isn't even hard to accomplish.

so just map it like this:
(rec (x y) z) -> (with (x "top secret") z) -> (app (fun (x) z) "top secret")
and you're done (of course you will not encode the intermediate step in your implementation)

citta
Mausschubser
Beiträge: 96
Registriert: 7. Nov 2006 21:52

Re: the 11th homework assignment

k ty

MisterD123
Geek
Beiträge: 811
Registriert: 31. Okt 2006 20:04