1 Learning Functional Programming

 

In this chapter you will learn

  • who is this book for
  • what is a function
  • how useful is functional programming
  • how to install needed tools
  • how to use this book

I can only approach you by particular examples and let you infer what it is.

— Richard Hamming, “Learning to Learn”

1.1 Perhaps you picked up this book because...

You are curious about functional programming

You heard about functional programming, read the Wikipedia entry, and looked at a few books too. Maybe you rolled your eyes at the mathy explanations behind all the code, but you still remained curious about it.

Text Description automatically generated

You tried to learn functional programming before

You have tried learning functional programming more than once, and still don’t get it. Just when you understand one key concept, the next obstacle waits around the corner. And this time it requires understanding of many more things before even approaching it.

Text Description automatically generated

You are still on the fence

You have been programming for many years in an object oriented or imperative programming language. You have experienced the buzz of functional programming, read some blog posts, and tried coding a bit. Still, you cannot see how it makes your programming life better.

Text, letter Description automatically generated

Or maybe something else?

1.2 What do you need to know before we start?

1.3 What do functions look like?

1.4 Meet the function

1.5 When the code lies...

1.6 Imperative vs declarative

1.7 Coffee Break: Imperative vs declarative

1.8 Coffee Break Explained: Imperative vs declarative

1.9 How useful is learning functional programming?

1.10 Leaping into Scala

1.11 Practicing functions in Scala

1.12 Getting your tools ready

1.13 Getting to know the REPL

1.14 Writing your first functions!

1.15 How to use this book?

1.16 Summary