It’s About Immutability

Unfortunately, strict purity and the real world don’t play well together. Pure functions can be used to model some domains well, others not so much. Compilers are pure functions. Google’s search is not.

Practical functional programming languages emphasize immutability and functional purity, but they must have some means of modeling a changing world that stops short of total functional purity. In Haskell, probably the most strict functional language, you can model change using monads, and otherwise maintain strict purity.

Other functional languages have other techniques for minimizing and controlling state change that may not be quite as strict as Haskell’s. Clojure, for instance, uses a software transactional memory ...

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.