by Venkat Subramaniam
In Chapter 3, Scala and Functional Style, we discussed higher-order functions in functional programming, and in Chapter 4, Working with Scala Collections, we looked at the higher-order functions in the Scala collections API. In this chapter, we’ll learn how to write our own higher-order functions.
Higher-order functions can accept other functions as parameters, can return functions, and can allow you to create functions within functions. In Scala, these functions that can be passed around are called function values.
You know that in OO programming, classes (or objects) abstract and encapsulate behavior and data. Well, function values also abstract and encapsulate ...