title: Haskell: Why does this work -- an example of memoization?
body: <p>Hi I am looking at this example from <a href="http://www.haskell.org/haskellwiki/Memoization">Memoization</a>:</p>
  
  <pre><code>memoized_fib :: Int -&gt; Integer
  memoized_fib = (map fib [0 ..] !!)
      where fib 0 = 0
            fib 1 = 1
            fib n = memoized_fib (n-2) + memoized_fib (n-1)
  </code></pre>
  
  <p>I am just wondering why this even work, since for me if you call <code>memoized_fib(n-2)</code> then you are "creating" a new list and doing things with it and after your return from it the list containing partial result would be gone? So <code>memorized_fib(n-1)</code> won't benefit from it at all?</p>