Seite 1 von 1

Question to Fixpoint Combinator

Verfasst: 26. Jan 2014 12:34
von Stao
In the solution of A4 / Task 2 :

Possibility 1 states:
...
-> (\n. (\y. (\x. myfun (\y. x x y)) (\x. myfun (\y. x x y)) y) (n+1))
-> (\n. Z myfun (n+1))

in my opinion it should be:

-> (\n. (\y. (\x. myfun (\y. x x y)) (\x. myfun (\y. x x y)) y) (n+1))
-> (\n. (\y. (Z myfun) y) (n+1))

where is \y ... y ?

the same is in Possibility 2:

-> myfun (\y. (\x. myfun (\y. x x y)) (\x. myfun (\y. x x y)) y)
-> myfun (Z myfun)

instead of:

-> myfun (\y. (\x. myfun (\y. x x y)) (\x. myfun (\y. x x y)) y)
-> myfun (\y. (Z myfun)y)

where is my mistake?

Re: Question to Fixpoint Combinator

Verfasst: 27. Jan 2014 07:20
von erdweg
You are right, there is an intermediate step missing, I added it to the solution.

You can reduce

Code: Alles auswählen

(\y. f y)
to by what is called eta-reduction. This reduction makes sense because the lambda is only forwarding the argument anyway; you might as well call f directly. (Note that this may lead to the evaluation of , which was previously covered by the lambda.)

Hope this helps,
Sebastian

Re: Question to Fixpoint Combinator

Verfasst: 28. Jan 2014 11:50
von Stao
yes :) thanks