CS 15-212: Fundamental Structures of Computer Science II

Lecture 12: Signatures and Functors

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


[ home | schedule | language | assignments | handouts ]

John Lafferty
lafferty@cs.cmu.edu