>>107602987
>>107603074
>i don't really understand nor like how scheme does internal state
;; the global environment is a list of bindings
env = ((+ . #<prim>) (- . #<prim>))
;; definitions extend the global environment
eval = (define (f x) (+ x x))
env = ((f . #<lambda>) (+ . #<prim>) (- . #<prim>))
;; when a function is called, the environment is
;; temporarily extended to bind values to parameters
eval = (f 2)
env = ((x . 2) (f . #<lambda>) (+ . #<prim>) (- . #<prim>))
;; so x is bound to 2 in the body of f, and + is globally visible
Comment too long. Click here to view the full text.