I am working through the book https://www.packtpub.com/application-development/haskell-high-performance-programming and at moment, I am trying to understand the memoization.
It shows the following memoization function:
fib_mem :: Int -> Integer
fib_mem = (map fib [0..] !!)
where fib 0 = 1
fib 1 = 1
fib n = fib_mem (n-2) + fib_mem (n-1)
In the book, it says:
So if fib_mem is defined at the top level, the results will persist in memory over the lifetime of the programm itself!
What does it mean, define at the top level?