Chapter 1Patterns and Functional Programming
Patterns and functional programming go together in two ways. First, many object-oriented design patterns are simpler to implement with functional programming. This is true for several reasons. Functional languages give us a concise way of passing around a bit of computation without having to create a new class. Also, using expressions rather than statements lets us eliminate extraneous variables, and the declarative nature of many functional solutions lets us do in a single line of code what might take five lines in the imperative style. Some object-oriented patterns can even be replaced with a straightforward application of functional language features.
Second, the functional world also has its ...
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