Chapter 2Functional Thinking for the Imperative Mind

by Michael Bevilacqua-Linn

It can be difficult to pin down exactly what functional programming is.

It’s difficult because the term, although theoretically well defined, has in practice come to encompass several different, though related, ideas. If you talk to a Clojure hacker, you’ll probably get an earful of macros. A Haskell programmer might talk about monads, and an Erlang programmer about actors.

These are all different concepts. Macros give programmers extremely powerful metaprogramming, monads allow us to model changing state safely, and actors provide a robust way of doing distributed and concurrent programming.

Yet all of these different ideas are seen as defining features ...

Get Functional Programming: A PragPub Anthology 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.