Variable in a function
问题 I have see the following code... The first call of (next-num) returns 1 , and the second returns 2 . (define next-num (let ((num 0)) (lambda () (set! num (+ num 1)) num))) (next-num) ; 1 (next-num) ; 2 What I can not understand is... num is created by let inside next-num , it is kind of a local variable... How does scheme know that each time next-num is called, the value of num is not erased by let ((num 0)) ; How does scheme know that it is always the same num that we modify whenever next