title: Why does scheme find a variable defined with "define" and not "let"
body: <p>So here's a question about scheme variable binds.  Let's say I have the following function:</p>
  
  <pre><code>(define undefinedTest (lambda (y) (list x y)))
  </code></pre>
  
  <p>This will warn of x being an unbound variable when run in Guile-Scheme 2.0.3.  If I then execute the following statement</p>
  
  <pre><code>&gt; (let ((x 'something)) (undefinedTest 'else))
  </code></pre>
  
  <p>I will get an error and the option to debug it.  However if I execute the following statements:</p>
  
  <pre><code>&gt; (define x 'something)
  &gt; (undefinedTest 'else)
  </code></pre>
  
  <p>I get the expected answer of (something else).  Why is scheme able to bind x when it is defined at the top-level, but not when it is bound by let.  Is this because when the function is defined it is also defined at the top-level, and so when scheme go to search its nearest enclosing environment, the let environment is not actually "enclosing" as it still starts its search at the "top-level"?  </p>