Reputation: 15
This is from the MIT 6.001 Online Tutor, it's part of the third problem set.
Question: Indicate the type of each of the following expressions. If you need type variables, use A,B,C, etc., starting with A as the leftmost variable.
(lambda (x y) x)
= A,B->A
(lambda (p) (p 3))
(lambda (p x) (p x))
= (A->B), A->B
(lambda (x y comp) (if (comp x y) x y))
As you can see I solved 1 and 3, but that was mainly out of luck. I still am having issues with understanding the concept and that is stopping me from solving 2 and 4.
Lecture slides can be found here (view the last few).
Upvotes: 0
Views: 521
Reputation: 223023
(the last assumes that x
and y
are the same types)
Upvotes: 2