# SICP section 3.2 - the environment model of evaluation

All diagrams in this post were created with draw.io.

## Exercise 3.09

For ease of diagramming, I’m evaluating (factorial 3) instead of (factorial 6).

Environments created by the recursive version:

Environments created by the iterative version:

## Exercise 3.10

Again, for ease of diagramming, I’m omitting the environments created as a result of evaluating (define W2 (make-withdraw 100)).

Environments created by applying the procedure object W1:

Environments after the call to W1:

With this version of make-withdraw, an additional environment E2 is created, in which balance is bound to the value of the initial-amount parameter.

## Exercise 3.11

Environments created by the first application of the procedure object acc (deposit):

Environments after the first call to acc, plus the ones created by the second application of acc (withdraw):

If another account acc2 is defined, its local state will be kept in its own environment, separate from the environment which keeps the local state for acc.