# SICP Solutions

### Chapter 3, Modularity, Objects, and State

#### Exercise 3.31

In every gate we defined, we call add-action for each input wire but we do not call it explicitly but rely on the fact that when signal changes then action procedure will be triggured.

Now consider for the initial values/signals in the wire? There is not change in the signal so it may happen that for an and-gate if initial values(at the time when the and-gate object is created/defined) for both input wires are 1, even then the output wire will contain the initial value of output wire instead of the the result generated by applying and-gate to the input wire.

Another solution to fix this problem is to invoke/initialize/evaluate the output when a new circuit/gate is created. This means every time a new circuit is defined then the person defining it must remember to call for the first time. The problem with this approach is there are too many places where this extra call will be placed - whereas the approach presented in book requires only a single line of code in just one place.