Uploaded by sai venkata durga prasad

ques

advertisement
Computer Science
Need help with OCaml type inferencing.
Consider a situation where the expressions f x g y and g y and
(y 26) ^ “alpha” are well-typed. Now assume that the expression y 16 evaluates to the same value as the expression x “foo” “bar” evaluates to.
a) What is the type of f? If the information is not enough to decide the type of each argument, use ‘a, ‘b, ‘c , etc… to substitute the type of those arguments.
b) Is the expression f x g y 39 well-typed? Provide reasons to support your answer.
Download