This homework has two types of problems:
Self Check: You are strongly encouraged to think about and work through these questions, but you will not submit answers to them.
Problems: You will turn in answers to these questions.
(Required) Read Mitchell, Chapter 5.
(As necessary) Read ML references, as needed for the programming questions.
Mitchell, Problem 5.4
You are not required to submit a program file for this question, but you may want to double check your answer by running your solution. If you do, be sure to include
Control.Print.printDepth:= 100;
at the top of your file, so that datatypes print completely.
Mitchell, Problem 5.5
You are not required to submit a program file for this question, but you may want to double check your answer by running your solution.
Mitchell, Problem 5.6
You are not required to submit a program file for this question, but you may want to double check your answer by running your solution.
Note that you MUST explain why the equations hold. One way to do this is to apply both sides of each equation to the same argument(s) and describe how each side evaluates to the same term. For example, show that
and
for any \tt s and \tt t.
Type Inference Checker
Triceratypes is a Type Inference Checker to help you practice the type inference algorithm. You can find it on the CS334 website here.
Infer the type for the following function using our type inference algorithm:
fun f(g,h) = g(h) + 2;

What is the type of the following ML function?
fun append(nil, l) = l
| append(x::l, m) = append(l,m);
Write one or two sentences to explain succinctly and informally why
append has the type you give. This function is intended to append
one list onto another. However, it has a bug. How might knowing the
type of this function help the programmer to find the bug?
Submit your answers to the GradeScope assignment named, for example, "HW 0". It should:
You will be asked to resubmit homework not satisfying these requirements. Please select the pages for each question when you submit.