23 hours ago
my attempt to do the exercises in sicp.
Saturday, March 13, 2010
sicp exercise 3.28
; Exercise 3.28. Define an or-gate as a primitive function box. Your or-gate constructor should be similar to and-gate.
(define (or-gate a b out)
(define (or-action-procedure)
(let ((new-value (logical-or (get-signal a) (get-signal b))))
(after-delay or-gate-delay
(lambda()
(set-signal! out new-value)))))
(add-action! a or-action-procedure)
(add-action! a or-action-procedure))
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment