Caching avoids repeating expensive computations by storing each result under a key and returning it when the same input appears again. A cache sits between a function call and its expensive operation, serving as an intermediary repository for reusable values. section 7.3
Memoization applies this idea to functions: arguments generate a unique key, the first call computes and stores the result, and later calls with the same arguments produce a cache hit. Referential transparency makes this reuse reliable. section 7.3
Memoizing a repeated computation
Memoized ROT13 computes the discount code once: the first run takes about 0.733 ms, while the second takes about 0.021 ms. Memoized student lookup similarly reduces repeated composed processing from about 9.2 ms to 2.5 ms.





































