Chapter 5Creating Higher-Order Functions in Scala
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access