LetRec with Substitution

lkbaerenfaenger
Mausschubser
Mausschubser
Beiträge: 44
Registriert: 13. Mär 2012 12:44

LetRec with Substitution

Beitrag von lkbaerenfaenger »

Hi,

with my current implementation of substitution-based LetRec, one of the open test cases as well as two of the hidden ones fail:

Code: Alles auswählen

def test8 = expect(Num(120))
    { interp(Let('fact, 42, App(fact, 5))) }

Code: Alles auswählen

Test test8 failed: can only apply functions, but got: Num(42)
Isn't what my compiler does the correct thing? I mean, "applying" 5 to 42 is an illegal expression, right? :shock:

Best
Lucas

kbraden
Mausschubser
Mausschubser
Beiträge: 98
Registriert: 15. Okt 2010 20:35

Re: LetRec with Substitution

Beitrag von kbraden »

Note the difference between 'fact and fact. The latter is a scala variable with the previous defnition of 'fact, your scoping appears to be wrong.

lkbaerenfaenger
Mausschubser
Mausschubser
Beiträge: 44
Registriert: 13. Mär 2012 12:44

Re: LetRec with Substitution

Beitrag von lkbaerenfaenger »

I don't know what to say... Thanks man! :oops:

Antworten

Zurück zu „Archiv“