Next: Digital Electronics (50 per
Up: Michaelmas Term 1997: Part
Previous: Introduction to Computer Science
Lecturer: Dr L.C. Paulson
(lcp@cl.cam.ac.uk)
No. of lectures + practicals: 15 + 6
- Introduction.
-
Levels of abstraction. Floating-point numbers, and why von Neumann
was wrong. Why ML? Integer arithmetic. Giving names to values.
Declaring functions. Static binding, or declaration versus
assignment.
- Recursive functions.
-
Examples: Exponentiation and summing integers. Overloading.
Decisions and booleans. Iteration versus recursion.
- O Notation.
-
Examples of growth rates. Dominance. O, Omega and Theta. The costs
of some sample functions. Solving recurrence equations.
- Lists.
-
Basic list operations. Append. Naive versus efficient
functions for length and reverse. Strings.
- More on lists.
-
The utilities take and drop.
Pattern-matching: zip, unzip. A word on polymorphism. The ``making change''
example.
- Sorting.
-
A random number generator. Insertion sort, mergesort, quicksort.
Their efficiency.
- Datatypes and trees.
-
Pattern-matching and case expressions. Exceptions. Binary tree
traversal (conversion to lists): preorder, inorder, postorder.
- Dictionaries and arrays.
-
Functional arrays. Dictionaries: association lists (slow)
versus binary search trees. Problems with unbalanced trees.
- Queues and search strategies.
-
Depth-first search and its limitations. Breadth-first search (BFS).
Implementing BFS using lists. An efficient representation of queues.
Importance of efficient data representation.
- Functions as values.
-
Nameless functions. Currying.
- List Functionals.
-
The ``apply to all'' functional, map. Examples: matrix transpose and
product. The ``fold'' functionals. Predicate functionals ``filter''
and ``exists''.
- Polynomial arithmetic.
-
Addition, multiplication of polynomials using ideas from sorting,
etc.
- Lazy evaluation.
-
Non-strict functions such as IF. Call-by-need versus
call-by-name. Lazy lists. Their implementation in ML.
Applications, for example Newton-Raphson square roots.
- References.
-
Address versus contents. Assignment versus binding.
Own variables. Arrays, mutable or not.
- Linked lists using references.
-
Surgical concatenation, reverse, etc.
Recommended books:
Paulson, L.C. (1996). ML for the Working Programmer. Cambridge
University Press (2nd ed.).
Wikström, Å. (1987). Functional Programming using Standard
ML. Prentice-Hall.
Harrison, R. (1993). Abstract Data Types in Standard ML. Wiley.
Next: Digital Electronics (50 per
Up: Michaelmas Term 1997: Part
Previous: Introduction to Computer Science
Christine Northeast
Sat Sep 27 09:31:14 BST 1997