I'm somewhat confused regarding dynamical scoping, specifically what happens when a formal parameter and a free variable share a name.
For example
(define x 1)
(define f (lambda (x) x) )
(f 2)
If this code is compiled and evaluated using dynamic scoping, what would be the input? 2 or 3?
While it seems as if the assignment (x = 2) from the parameter is the most 'recent' so it should be '2', some have told me the answer is 1 (and others said its 2. Everyone is confused).
{I know scheme and most languages use lexical scoping, but tell that to my professor}
I would appreciate any help I can get.