A Small Aside: Memoization
Learn about memoization relation with pure functions.
We'll cover the following...
In an earlier chapter, we briefly discussed how FP could be less performant than other styles of programming in some situations. Besides the advantages of high-level programming when it comes to optimizations that an engine might perform without us even knowing, one specific and powerful tool is available to the functional programmer: memoization.
Memoization relation with pure functions
Memoization gains its power from pure functions. Because we know that a pure function’s result is only dependent on what we pass in, we can deduce that if we calculate the result for a given set of parameters, we can return that ...