my attempt to do the exercises in sicp.

Sunday, March 14, 2010

sicp exercise 3.31

;; Exercise 3.31.   The internal procedure accept-action-procedure! defined in make-wire specifies that when a new action procedure is added to a wire, the procedure is immediately run. Explain why this initialization is necessary. In particular, trace through the half-adder example in the paragraphs above and say how the system's response would differ if we had defined accept-action-procedure! as

;; (define (accept-action-procedure! proc)
;;   (set! action-procedures (cons proc action-procedures)))

;; Ans:
;; This adds action procedures to the agenda. If procedure is not called nothing will be added to the agenda. This also initializes the system.

No comments: