5
Higher-Order Functions
A very important feature of the functional programming paradigm is higher-order functions. We’ll look at these three varieties of higher-order functions:
Functions that accept functions as one (or more) of their arguments
Functions that return a function
Functions that accept a function and return a function, a combination of the preceding two features
We’ll look at the built-in higher-order functions in this chapter. Separate from these functions, we’ll look at a few of the library modules that offer higher-order functions in later chapters after introducing the concepts here.
Functions that accept functions and create functions include complex callable classes as well as function decorators. We’ll defer consideration of decorators until Chapter 12, Decorator Design Techniques.
In this chapter, we’ll look at the following functions:
max()
andmin()
map()
filter()
iter()
sorted()
Additionally, we’ll look...