6HIGHER-ORDER FUNCTIONS

Image

Higher-order functions are central to functional programming and flow naturally from the idea that functions should be “first-class objects” in a language, with all of the rights and privileges that numbers or lists have. A higher-order function is one that accepts a function as input and/or returns a function as output. Many things we want the computer to do for us find a natural expression as a higher-order function.

In this chapter, we’ll first look at higher-order functions that produce functions as output. We’ll see that these higher-order functions can be viewed as having one input, or alternatively, as having multiple ...

Get Learn Physics with Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.