Functional programming building blocks
I’ve been really focusing on functional programming lately, and not necessarily in functional languages, but the underlying concepts and how to apply them in the languages I’m currently using. Here I’ve put together a small compilation of the most fundamental building blocks in functional programming together with links to resources about them.
Functional programming concepts
John Hughes wrote a famous paper called Why Functional Programming Matters, in which he focuses on higher-order functions and lazy evaluation. Higher-order functions helps you be more declarative, writing what you want, not how you compute it. List comprehensions is also useful for being declarative.
Having functions as first class values together with [lexical scope](http://en.wikipedia.org/wiki/Scope_(computer_science) gives you the power to encapsulate data and behaviour as an object in OOP just using functions.
By limiting side effects and using pure functions makes it easier to reason about program behaviour since it avoids mutating states.
Functional programming promotes using values, that are immutable. Apart from the benefits immutability gives in concurrent programming, it also separates values from state and identity.
Taking the most important parts from OOP
Some languages try to incorporate the object oriented paradigm together with functional programming, most notably Scala. In Clojure you still get the benefits from encapsulation and polymorphism, while going as far as claiming OOP to be overrated.
← Go Back