What is a First-Class Function?
When a function takes in another function as an argument and/or returns a function as its value, it is known as a higher-order function. The map example above is a higher-order function.
A function passed as an argument to another function is known as a callback function.
Not all programming languages have first-class functions. With Ruby, for example, methods cannot be assigned to variables or be passed to other methods.
- Stack Overflow – What is Meant by First-Class Object?
- Stack Overflow – What are First-Class Objects?
- Wikipedia – First-Class Function
- Wikipedia – Higher-Order Function