the 11th homework assignment

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

the 11th homework assignment

Beitrag von vaidas »

The last homework assignment is online:
https://cage.st.informatik.tu-darmstadt ... gnment/11/

Vaidas

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

Re: the 11th homework assignment

Beitrag von citta »

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?

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

Re: the 11th homework assignment

Beitrag von MisterD123 »

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
Mausschubser
Beiträge: 96
Registriert: 7. Nov 2006 21:52

Re: the 11th homework assignment

Beitrag von citta »

k ty

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

Re: the 11th homework assignment

Beitrag von MisterD123 »

y np :P

Antworten

Zurück zu „Archiv“