O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required