What is functional programming? Rúnar Óli defines it as:
programming with functions.
What’s a function?
f: A => Brelates every value of type ofAto excatly one value of typeBand nothing else.
To clarify the “nothing else” part, he introduces the notion of referential transparency as follows:
An expression
eis referentially transparent if every occurrenceecan be replaced with its value without affecting the observable result of the program.
Using this notion, we can think of functional programming as building up referentially transparent expression tree. Memoization is one way of taking the advantage of referential transparency.