title: Help with dynamic-wind and call/cc
body: <p>I am having some trouble understanding the behavior of the following 
  Scheme program:</p>
  
  <pre><code>(define c
    (dynamic-wind
      (lambda () (display 'IN)(newline))
      (lambda () (call/cc (lambda (k)
                       (display 'X)(newline)
                       k)))
      (lambda () (display 'OUT)(newline))))
  </code></pre>
  
  <p>As I understand, c will be bound to the continution created right before "(display 'X)".</p>
  
  <p>But using c seems to modify itself! The define above prints (as I expected) IN, X and OUT:</p>
  
  <pre><code>IN
  X
  OUT
  </code></pre>
  
  <p>And it is a procedure:</p>
  
  <pre><code>#;2&gt; c
  #&lt;procedure (a9869 . results1678)&gt;
  </code></pre>
  
  <p>Now, I would expect that when it is called again, X would be printed, and it is not!</p>
  
  <pre><code>#;3&gt; (c)
  IN
  OUT
  </code></pre>
  
  <p>And now c is not a procedure anymore, and a second invokation of c won't work!</p>
  
  <pre><code>#;4&gt; c    ;; the REPL doesn't answer this, so there are no values returned
  #;5&gt; (c)
  
  Error: call of non-procedure: #&lt;unspecified&gt;
  
          Call history:
  
          &lt;syntax&gt;            (c)
          &lt;eval&gt;              (c)    &lt;--
  </code></pre>
  
  <p>I was expecting that each invokation to (c) would do the same thing -- print IN, X, and OUT. What am I missing?</p>