ABSTRACT

Why learn functional programming? Isn’t that some complicated ivory-tower technique used only in obscure languages like Haskell?

In fact, functional programming is actually very simple. It’s also very powerful, as Haskell demonstrates by throwing away all the conventional programming tools and using only functional programming features. But it doesn’t have to be done that way.

Functional programming is a power tool that you can use in addition to all your usual tools, to whatever extent your current mainstream language supports it. Most languages have at least basic support.

In this book we use Python and Java and, as a bonus, Scala. If you prefer another language, there will be minor differences in syntax, but the concepts are the same.

Give functional programming a try. You may be surprised how much a single power tool can help you in your day-to-day programming.

chapter Chapter 1|4 pages

What Is Functional Programming?

chapter Chapter 2|15 pages

Methods and Functions

chapter Chapter 3|9 pages

Higher-Order Functions

chapter Chapter 4|15 pages

Functional Interfaces in Java

chapter Chapter 5|4 pages

If Expressions

chapter Chapter 6|8 pages

Comprehensions

chapter Chapter 7|7 pages

Closures

chapter Chapter 8|8 pages

Currying

chapter Chapter 9|4 pages

Function Composition

chapter Chapter 10|4 pages

Optional Values

chapter Chapter 11|7 pages

Lists

chapter Chapter 12|6 pages

Streams

chapter Chapter 13|10 pages

Important Functions

chapter Chapter 14|11 pages

Pipelines

chapter Chapter 15|6 pages

Summary and Final Examples

chapter |2 pages

Afterword