SICP Exercise 4.12 abstractions for traversing the environment structure

Exercise 4.12.  The procedures set-variable-value!define-variable!, and lookup-variable-value can be expressed in terms of more abstract procedures for traversing the environment structure. Define abstractions that capture the common patterns and redefine the three procedures in terms of these abstractions.

SOLUTION

The code and tests are here. The abstractions that capture the common patterns in traversing the environment structure can be found in the new procedures named 'find-variable-position-in-env' and 'find-variable-position-in-frame'.


Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions