SICP Solutions

Chapter 5, Computing with Register Machines

Exercise 5.44

This works fine as suggested in the problem but notice this statement in the problem:

The code will work correctly as long as the program does not define or set! these names

Defines and redefines inside local procedure are taken cared by ex-5.43 but..

What if we defined +, or * in the global environment?

We know from statement of ex-5.42(see the tip 47 in it too) that because the global environment is dynamic, we can not store the variables of global environment in compile time environment!

Because of this we can not redefine or define these primitives in global environment in this context.

Example

Tested on the example given in the problem:

Since this mark the completion of the changes because of compile time environment, I shall put the complete code here:

File: ch5-compiler.scm:

There are few changes in ch5-syntax.scm - to supprt let?

Also, there are few changes as part of ex-5.39:

(As of now i put these changes in ch5-eceval-support.scm):