Why Functional Programming Is Crazy

We already know one reason why functional programming is crazy: Functional programs can’t really do anything, since they can’t have side effects. As Simon Peyton Jones, a well-known functional programmer, likes to say, “All you can do without side effects is push a button and watch the box get hot for a while.” (Which isn’t technically true, since even the box getting hot is a side effect.)

We’ve seen that we can work around this limitation of functional programming by adding a dirty section to our programs, which is kept separate from the rest of the code and contains all our code that is imperative and not in the functional style. However, recall the problem with the functional style: It can cause code to be ...

Get Land of Lisp 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.