Lesson 4. First-class functions
After reading lesson 4, you’ll be able to
- Understand the definition of first-class functions
- Use functions as arguments to other functions
- Abstract computation out of a function
- Return functions as values
Although functional programming has long had the reputation of being overly academic, nearly all of the key features of functional programming languages are starting to appear in many other more mainstream programming languages. The most widespread of these features is that of first-class functions. These are functions that can be passed around like any other values. A decade ago, this idea was shocking to many programmers, but today the majority of programming languages support and frequently use this concept. ...