(let [x 1]
(defn make-adder [y]
(fn [] (+ x y)))
(defn make-multiplier [z]
(fn [] (* x z)))
(defn mutate! [new-x]
(set! x new-x)))
Now for
(make-adder 2)
we get a function whose environment includes x and y, whereas the environment for
(make-multiplier 2)
includes x and z. Assuming you have shallow environments, you'll have one environment [x' y] and another one [x'' z], whereas with deep environments (like in ClojureC) you'd have [[x] y] and [[x] z] where the [x] is shared between them. Now, if you call
(mutate! 3)
with deep environments you only need to store the 3 once (to x), whereas with shallow environments you'll need to store to x' and x''.