Smatchcube's website 🌍

Exercise 3.10

Result of defining make-withdraw in the global environment:

Result of evaluating (define W1 (make-withdraw 100)):

The two versions of make-withdraw create objects with the same behavior, the body of the W2 procedure is exactly the same with both versions. The difference comes from the environment structures, the new version uses two frames linked to together to the global environment when the old version used only one frame.

Environments created by applying the procedure object W1 with argument 50:

Environments after the call to W1:

Result of evaluating (define W2 (make-withdraw 100)):