4 Functions as values

In this chapter you will learn

  • how to pass functions as arguments
  • how to use the sortBy function
  • how to use map and filter functions
  • how to return functions from functions
  • how to treat functions as values
  • how to use the foldLeft function
  • how to model immutable data using product types

The most damaging phrase in the language is: ‘We’ve always done it this way!’

—Grace Hopper

Implementing requirements as functions

We spent some time working with pure functions and immutable values. They make up the foundation of functional programming. This chapter focuses on showing how well these two concepts work together. We will discover how helpful it is to think about business requirements in terms of functions and how to treat ...

Get Grokking 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.