Someone asked about this test code from lab 4 in the lab session today:
twice f x = f (f x) ;
fst x y = x ;
main = fst (twice (\x -> x)) 6 7 ; -- result 7
Tracing it on paper, we found out that the result would be 6, but 7 is
indeed the correct one with the parentheses set as above.
The evaluation should be something like:
fst (twice (\x -> x)) 6 7 <- here fst is applied on the function and 6
(twice (\x -> x)) 7
(\x -> x) ((\x -> x) 7)
(\x -> x) 7
7
cheers,
Arnar