Course Links

Resources

External

This homework consists of five exercises working with lists in OCaml. Just as with the labs and previous homeworks, the assigned tasks are described in comments contained within the code. You can download the starter files here.

You may work with a partner for this assignment if you adhere to the guidelines.

Hints

Proceed in small, discrete steps, making sure that your program compiles each time. If it does not, back up and try again. It is much easier to debug a small section of code than a large one. Use inspection, printing, and compiler error messages to identify and fix any errors.

When you write the recursive functions, remember that structural recursion usually produces small, simple programs. You will typically have two, maybe three patterns, and each one will generate a fairly short expression. If you find yourself writing a lot more code than that, ask whether it is really necessary.

This assignment is based on a longer one from the UPenn course we have been following. You can read the FAQ for that assignment. (Not all the items will apply because our assignment is shorter and we are not using Codio.)

Remember that each time you change your program, you need to compile it again before you run it. The commands to do that are:

ocamlopt -o hwOCaml2 assert.ml hwOCaml2.ml
./hwOCaml2

To Submit