So here's a question about scheme variable binds. Let's say I have the following function:
(define undefinedTest (lambda (y) (list x y)))
This will warn of x being an unbound variable when run in Guile-Scheme 2.0.3. If I then execute the following statement
> (let ((x 'something)) (undefinedTest 'else))
I will get an error and the option to debug it. However if I execute the following statements:
> (define x 'something)
> (undefinedTest 'else)
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"?