Memoization
The next two relatively advanced topics I will cover somehow resemble the Just in Time approach taken outside of the compilation context. With Just in Time (https://en.wikipedia.org/wiki/Just_in_Time), Wikipedia comes up first with a production strategy in manufacturing, where components are delivered immediately before being utilized as a way of being lean on inventory costs.
As a matter of fact, memoization and lazy evaluation complement each other in this lean calculation sense. While laziness allows you not to perform calculations until the result is absolutely required, memoization makes the results of the already performed fat resource expensive calculations reusable by not allowing them to be wasted.
I have already used memoization somewhat when implementing prime number generation earlier in this chapter for covering mutual recursion. An expensively generated sequence was cached there in order to use the already generated elements to find the next ones, which are not...