I think it is more accurate to say that the result of calling fib-2 has a "global" side effect of defining fib-iter. fib-iter would have access to the variable n, which is closed over, that is not accessible outside of it after fib-2 has returned.
Example:
(defun test (n)
(defun test-inner (p)
(+ n p)))
(test 3) ; returns function test-inner, but now...
(test-inner 4) ; returns 7
This is called a closure. Scheme supports these, too, and in fact your inner defines, if they define functions, would be closed over as well. They just wouldn't *also* be saved in the "global" scope.
(Note that I put "global" in quotes; it's not exactly global - it's in the current package in CL.)
>
> In Scheme, I tried using glide, the fib-iter defined within fib-2 is
> locally scoped. Is it so called the difference between lisp-1 and lisp-2?
>
More or less. The question to ask when comparing a lisp-1 and a lisp-2 is how many values can be associated with a single symbol?
In Scheme, the answer is "exactly one"; if you
(define x
(lambda (y)
(+ y 5))
x ; returns a function
(x 3) ; returns 8
(x x) ; error - can't add function to integer or similar.
(Explicit lambda for clarity) But then subsequently:
(define x 5)
x ; returns 5
(x 3) ; error - not a function or similar.
So in Scheme, the symbol 'x refers to *either* a function or a variable, but not both. That is why it is a lisp-1.
In Common Lisp, on the other hand, the symbol 'x can hold a separate value for a variable and a function. My example in your duplicate thread was meant to address this (as I read it as the source of confusion), but here's perhaps a simpler example:
(defun x (y)
(+ y 5))
(defvar x 3)
(x x) ; returns 8 ***different from Scheme here.***
As clearly seen in the last expression, 'x can be either a function or a variable depending on where it is used. It is at least a lisp-2 because of that. You can address these values directly:
(symbol-function 'x) ; returns a function
(symbol-value 'x) ; returns 3
> Thanks again.
>
> Best,
> Jinsong
Hope it helps! I've used Scheme for longer than I've used CL, so I'm reasonably sure I've probably made some subtle error here, which hopefully someone will point out. The examples do work, though, I just tested them. :)