title: How do closures in Scheme work?
body: <p>I tested the following code in Racket/DrScheme:</p>
  
  <pre><code>(define (makem)
      (define x 34)
      (list (lambda () (set! x (+ x 1)) x)
            (lambda () (set! x (+ x 1)) x))
  )
  
  (define f (car (makem)))
  (define f2 (car (cdr (makem))))
  
  &gt; (f)
  35
  &gt; (f2)
  35            ; I thought this would give me 36
  &gt; (f)
  36
  &gt; (f)
  37
  &gt;
  </code></pre>
  
  <p>Does every lambda created inside a function call get a copy of every variable in their scope? Is it like some sort of implicit let? I expected the lambdas to have some sort o pointer to the scope in which they were created, enabling them to access the stack variables, but this tells me otherwise, since f and f2 seem to have different copies of x. What exactly happens?</p>