15-212: Principles of Programming

Lecture 12: Combinators

Combinators are functions of functions, that is, higher-order functions used to combine functions. One example is ML's compositon operator o.

The basic idea is to think at the level of functions, rather than at the level of values returned by those functions. Combinators are defined using the pointwise principle. Currying makes this easy in ML.

We first discuss combinators of functions of type int -> int. Then we discuss rewriting our regular expression matcher using combinators. We using staging. The regular expression pattern matching is in one stage, the character functions are in another.

Key Concepts

Sample Code

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

Michael Erdmann