15-212: Principles of Programming

Lecture 14: Functors and Substructures

A functor is a parameterized module that acts as a kind of function which takes zero or more structures as arguments and returns a new structure as result. Functors greatly facilitate hierarchical organization in large programs. In particular, as discussed in the next few lectures, they can enable a clean separation between the details of particular definition and higher-level structure, allowing the implementation of "generic" algorithms that are easier to debug and maintain, and that maximize code reuse.

Key Concepts

Sample Code

On-line Notes by Robert Harper

Suggested Reading in Programming in Standard ML:

[ CS 15-212 Home page | schedule | language | assignments | handouts ]

Michael Erdmann