We introduced SML's predefined list datatype for integers during lab
last week and again during the previous lecture.
An important point is that the list datatype is defined recursively:
An int list is one of the following (and nothing else):
Last time and today we wrote some functions taking list arguments and/or returning list values, and we showed how to prove theorems about lists using structural induction.
We discussed tail recursion, a form of recursion that is somewhat like the use of loops in imperative programming. This form of recursion is often used to make functions more efficient. Accumulator arguments play an important role in tail recursion. The presences of an accumulator argument in a function forces us to think carefully about the specification of the function and to prove corresponding theorems of correctness.