3 (define (half-adder a b s c)
4 (let ((d (make-wire)) (e (make-wire)))
11 (define (full-adder a b c-in sum c-out)
15 (half-adder b c-in s c1)
16 (half-adder a s sum c2)
22 ((not (null? coll)) (error "coll not a list"))
23 ((null? (cdr coll)) (car coll))
24 (else (last (cdr coll)))))
26 (define (butlast coll)
28 ((not (null? coll)) (error "coll not a list"))
29 ((null? (cdr coll)) '())
30 (else (cons (car coll)
31 (butlast (cdr coll))))))
33 (define (ripple-carry-adder a-list b-list s-list c)
34 (define (ripple-carry-adder-1 a-list b-list c-in s-list c-out)
38 (full-adder (last a-list)
43 (ripple-carry-adder-1 (butlast a-list)
48 (let ((c-in (make-wire))
51 (ripple-carry-adder-1 a-list
59 delay for s(n) = n x full-adder-delay
61 1 full-adder-delay = 2 x half-adder-delay + 1 x or-gate-delay
63 1 half-adder-delay = max ((and-gate-delay + inverter delay), or-gate-delay)