Introduction

Functional programming has its own set of patterns that have evolved out of the functional style.

These patterns rely heavily on immutability. For instance, Pattern 12, Tail Recursion, shows a general purpose replacement for iteration that doesn’t rely on a mutable counter, while Pattern 15, Chain of Operations, shows how to work with immutable data by chaining transformations on an immutable data structure.

Another theme in these patterns is the use of higher-order functions as a primary unit of composition. This dovetails nicely with the first theme, immutability and transformation of immutable data. By using higher-order functions we can easily do these transformations, as we demonstrate in Pattern 14, Filter-Map-Reduce ...

Get Functional Programming Patterns in Scala and Clojure 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.