SICP Exercise 3.28 or-gate

Exercise 3.28.  Define an or-gate as a primitive function box. Your or-gate constructor should be similar to and-gate.

SOLUTION

The code is here.

Note: I enhanced the or-action-procedure (from the and-action-procedure in the textbook) to call set! on the output wire only if the set! will change the signal on the wire. 

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