15-150: Principles of Functional Programming

Lecture 10: Higher-Order Functions

We define what it means to curry a function and how to write curried functions in SML.

We discuss closures (code and environment) and how bindings of function values to identifiers occur.

We discuss higher order functions, specifically, passing functions as arguments, returning functions as values, and mapping functions over recursive data structures. Key to understanding functions as first class values is understanding the lexical scoping rules.

We discuss several important higher-order functions, such as composition (given by SML's infix operator o) and the list functions map, foldl, and foldr.

Key Concepts

Sample Code

Some Notes on Higher-Order Functions