Higher-order functions are functions which either
- take functions as arguments or
- return them as output
(or both). Functions which do neither of these are known, in contrast, as first-order functions.
Higher-order functions are a cornerstone of the functional programming paradigm, in which the manipulation and transformation of functions is at least as common as the manipulation and transformation of data. That said, several of the most widely-implemented higher-order functions are also found in modern imperative languages. Examples include
- folding functions (