Aald HH $ @d HHHHff@  d Footnote TableFootnote**.\t.\t/ - :;,.!?6 `77`TOCHeading1Heading2   EquationVariables@eue 8fS9=g?hd:i;*j?k=l >m ;>o 5@-p ) I > )<$lastpagenum> *<$monthname> <$daynum>, <$year> +"<$monthnum>/<$daynum>/<$shortyear> ,;<$monthname> <$daynum>, <$year> <$hour>:<$minute00> <$ampm>ak -"<$monthnum>/<$daynum>/<$shortyear> .<$monthname> <$daynum>, <$year> /"<$monthnum>/<$daynum>/<$shortyear> 0 <$fullfilename> 1 <$filename>ff 2 <$paratext[Title]> 3 <$paratext[Heading1]> 4 <$curpagenum> 5 <$marker1> 6 <$marker2> 7 (Continued) 8+ (Sheet <$tblsheetnum> of <$tblsheetcount>) 9Heading & Page <$paratext> on page<$pagenum> :Pagepage<$pagenum> ;See Heading & Page%See <$paratext> on page<$pagenum>. < Table All7Table<$paranumonly>, <$paratext>, on page<$pagenum> =Table Number & Page'Table<$paranumonly> on page<$pagenum>  FFA* HHA ; JJ LL NN PP ee  MA>$d       < < 6 6 @ @   M 5y  xg5|  xa5  ua5 tod)5 ! u+t 5 " tu<$9; # a xn? $ z xnge9 % a xx p? & ju? ' j ~een? ( j ~He? ) j ~e<? * z ~ e? + j j? , j je? - j jl$p? . z ~o<? / j jTa? 0 j j&'? 1 j jay>? 2 | jp> ? 3 j ~? 4 j jF? 5 j j*? 6 j j? 7 j j;? 8 j jJ? 9 x? : a ~: ; : < j j: = j j: > j ~e: ? j: @ j j: A j j: B j ~: C j: D j j: E j j: F j ~: G j: H j: I x: J a ~;. K  6;/ L z j;0 M j j@; N a ~;1 O j j M;2 P j ~x;3 Q jx;4 R z ju;5 S j jt;6 T j ju;7 U j ~t;8 V ja;9 W j jz;: X j ja;; Y j ~j;< Z jj;= [ jj;> \ xj;? ] a ~z; ^ x xj; _ x xj; ` j xj; a j jz; b j jj; c j jj; d j jj; e j j|; f j jj; g j jj@1 h x xj? i j? j z jj? k j jj? l j ~x? m ja? n z j? o j jj? p j jj? q j ~j? r j? s j jj? t j jj? u j ~j? v j? w jj? x j? y z j? z j j? { j j? | j jx? } a ~a; ~ j j<  a ~z< x xj< xa< jj< jj< j< jz< jj< jj< j jj< j j< j jj< j jj< j jj< j j< j j< j jx j ja@? j jj@@ j ja@A j jx@B j j@C j j@D j j@v j j= = z j= j j> j ~j> jj> z jj> j jj> j jj> j j> j jj> jj> j j> j jj> j ja> j jx> j jj> j j> j j> j jj> j jj> j jj> jj> a xj>7 >8 z j>9 j jj>: j ~j>; jj> j jj>= j jj>> j jj@ j>@ j jj>A jj>B j j@ j jj@ j ~j@ j jj@ j jj@ j jj@ j jj@ j jj@ j jj@ j jj>L j jj>M a xj> jj@w j jj@x j jj@z j jj@} j j@ j j@E xz@F a ~j@ j jj> j j> a xz> j jj> j jj> j> j jj> j j> z ~j? j jj>  j jj>  j jj>  j jj>  j jj>  j jj@ @ j jj@ A j jj@ C j jj@ E j j5 >dq5zPF>:dq6jjLH>>dq7jj8C>BHm3R q897 jjHm3R H RH R FootnoteHr@ q98:7 jHr@ HzHz  Single LineH'q:9<7 ;;Footnote j  5_;:j     HD q<:=7 >HD HH  Double LineH q=<@7>>? Double Line z5c>?=j5e?>=@@ jH q@=B7AA Single Line5hA@HZqB@C7q TableFootnoteEGxR qCB7 9EGxR EPwEPw  TableFootnoteod7MDRRHH5xE5 HH Fe   HH5zFN5 HHlEE DHH5{G6 HH @>?HDoe   HH5}HJ6HHlGG HUV 5~I6 HUV AAJUU`   HUV 5JLH6HUV lII H$ 5K6 FtnH$ ELUU` tn oH$ 5LJ6H$ lKK HUV 5M5 HUV N UUe !  HUV 5NPF5HUV lMM H$ 5O5 H$ P UUe "  H$ 5PN5H$ lOO HH7NQD HHAR   h % 0Black-Box Abstraction - Managing Complexityg HH7PRDHHlcQQ HZv8S~T\f-c$8TUSU-c$l?$8UTVSTVV?$???8VUWSUW? ?2?6 8WVXSVX F6 >Õ>Õ sqrt;6 Point UR UT` & (define (make-point x y) 3UP UT` '  (lambda (bit) 3HUN UT` (  (if (zero? bit) x y))) z]UL UT` ) Ab arUJ UT` * ֶ; x-of: Point -> Num UH UT` + (define (x-of point) UF UT` , (point 0)) UD UT` -  VUB UT` . ; y-of: Point -> Num U@ UT` / (define (y-of point) U> UT` 0 (point 1)) U< UT` 1 d * ` 2 Check with Substitution Model entEU: UT` 3 (x-of (make-point 10 20)) ZU8 UT` 4 -(x-of (lambda (bit) (if (zero? bit) 10 20))) oU6 UT` 5 +(x-of [proc (bit) (if (zero? bit) 10 20)]) U4 UT` 6 *([proc (bit) (if (zero? bit) 10 20)] 0) U2 UT` 7 (if (zero? 0) 10 20) U0 UT` 8 10 ` 9  gQeQ3?gehdh} gQeQ3g^g^  Constructorg@eH3?hgidgi} m,g@eH3g@g@  AccessorsmEVc?ihjdhj}ma Hc (_X?Y^OK5EVH|?jikdik}*> N _ľ,BųaD8Y9 I?kj}dj}0 ;6 V_;GL8Y6{&v@ X87ݖLBu-8lZmSmu 0u-) X 8mlnSlnu ChX ÕÕ  fixed-point $8nmoSmou4$bit(i$8onpSnrub) $0 2])k?~X 8poqSqr 0 k?~X kk  (lambda (y)U0k?~X 8qprSpr k?~X kk  (/ x y))gk?~X8rqsSosuok?~Xpq?~ 8srtSrtu @?~  1^8tsuSsu^XY^^yk?~38utvSv~}*k?~3ltbl8vuwSuw~8Yblk8wvxSvz~VyxΒQRm ) -> given x & y coordinates, 3UP UT` = w4 create a new Point object bHUN UT` >  ]UL UT` ?  2. Accessors rUJ UT` @  (x-of ) UH UT` A ~ (y-of ) UF UT` B  UD UT` C  3. Contract ~UB UT` D Ӯd$ (x-of (make-point )) = U@ UT` E $ (y-of (make-point )) = U> UT` F  U< UT` G 4. Abstraction Barrier U: UT` H ? Say nothing about representation or implementation of Point! M-` I  HZm;+j-@;, b-@l -@;- -@[ UT UT` K ڪ1. Constructor truUR UT` L ֪ ; cons: T, T -> Pair x> 3UP UT` M y ' (cons ) -> given x & y parts, HUN UT` O - create a new Pair object ]UL UT` P ? rUJ UT` Q UJ 2. Accessors UH UT` R  ; car, cdr: Pair -> T -oUF UT` S UT- (car ) -> the first part of the pair cUD UT` T D. (cdr ) -> the second part of the pair UB UT` U  oU@ UT` V U> UT` W  (car (cons )) = cU< UT` X U: (cdr (cons )) = U: UT` Y on /U8 UT` Z Po4. Abstraction Barrier DU6 UT` [ ? Say nothing about representation or implementation of pairs! W` \ ;, bd:HH: HH  h ] KPair Abstractionj uHH:r> HHl  d:SrteUTHH:T o HH UF UT   h J pa' Point Data Abstraction (PS #2) i cdrHH:VBUTHHlc HZv?UT k < <-;?T-;l ay -;? i o-;3 UT UT` i 1. Constructor HUR UT` j :! ; make-rat: Int, Int -> RepRat 3UP UT` k ! (make-rat ) -> HUN UT` l  ]UL UT` m tr 2. Accessors rUJ UT` n : ; numer, denom: RepRat -> Int UH UT` o  (numer ) UF UT` p  (denom ) UD UT` q  UB UT` r ڪ 3. Contract U@ UT` s # (numer (make-rat )) = U> UT` t # (denom (make-rat )) = U< UT` u oi DU: UT` v S 4. Abstraction Barrier /U8 UT` w @ Say nothing about representation or implementation of RepRat! d;WHH;X HHy   l }  Rational Number Abstractionk HH;ZHHl  UT?R ?Tl ` n? HUTa <` p pR UT UT` x #5. Representation & Implementation UR UT` y  ; RepRat = Int X Int 3UP UT` z UT% (define (make-rat n d) (cons n d)) >HUN UT` { UT (define (numer r) (car r) v]UL UT` | on (define (denom r) (cdr r) CA1Ab5b5;@ len=ܬV^<w Ԁyfgf=ܬgf  AbstractionVDYAYA;@ Sei,Ԁ!cv!cSv!c  Violation!!H)lclc@j)lclc QCA1Aqq;@eAb@UAw ))b5b5;?C R #w Ԁ_%%#%  Abstraction< "YAYA;?D 9IvFi,Ԁm9Iv  Violation!!?)qq;?E R&J^w )CA1Alclc@CA1AlclcHZ@@.p@@/ Qmem@l 3UPd<7(nsUT HH<8 |onHH(c  ;@ ` N f#Layered Rational Number Operations D%` ^  3` _ ʋ BUT UT` ` Ӌ(define (+rat x y) HWUR UT` a ' (make-rat (+ (* (numer x) (denom y)) lclUP UT` b Ө( (* (numer y) (denom x)))  UN UT` c 5& (* (denom x) (denom y)))) UL UT` d % UJ UT` e io(define (*rat x y) ;UH UT` f $ (make-rat (* (numer x) (numer y)) UF UT` g ?& (* (denom x) (denom y)))) UD UT` ~   @@0 @` h  UT UT` (define (+rat x y) m,UR UT` ' (make-rat (+ (* (numer x) (denom y)) AUP UT` ( (* (numer y) (denom x))) VUN UT` & (* (denom x) (denom y)))) kUL UT`  UJ UT`  UH UT` (define (+rat x y) UF UT` La (cons (+ (* (car x) (cdr y)) DUD UT`  (* (car y) (cdr x))) UTUB UT` in (* (cdr x) (cdr y)))) U@ UT` (+ U> UT` )) cU< UT` Ө(define (+rat x y) num(U: UT`  " (let ((n (+ (* (car x) (cdr y)) =U8 UT` y)$ (* (car y) (cdr x)))) RU6 UT` (*! (d (* (cdr x) (cdr y)))) gU4 UT` r  (let ((g (gcd n d))) |U2 UT`  (cons (/ n g) y)U0 UT` ~ (/ d g))))) `  HH<:HHl UTd?RUT(+* HH? HH y `      h ) Cash Registerl HH?HHl C carHZv9>D ~^QgUBUT-c$9? U@-c$ ?$9@(d?$numU:??2?9AT2?  2?M?6 9B dr6 >Õ>Õ sqrt(lV6~O?~X 9J ~O?~X ~X~X  (lambda (y)$~]?~X 9K ~]?~X ~f~f  (/ x y))??~ 9L ?~  1hr9MhrÕhrrl)9N l)?9OxiRRm 9R q.> q7q7 sqrtinl@һ9Sl@һl@һq@һv~8 9T rv~8 BB average~~( 9U ~( BB -dampyo?~H$9V o?~H$ d<~ HH< HHRr   l Alternative +rat Operationsp HH<HHl d<HH< 9QHH `  Rationalizing Implementation q%` ʆ q4UT UT` (define (numer r) IUR UT` # (let ((g (gcd (car r) (cdr r)))) q^UP UT`  (/ (car r) g))) sUN UT`  UL UT` (define (denom r) UJ UT` # (let ((g (gcd (car r) (cdr r)))) UH UT` -d (/ (cdr x) g))) UF UT`  UD UT` (define (make-rat n d) <UB UT` ~ (cons n d)) U@ UT`  U> UT` <(define (gcd a b) 0U< UT`  (if (= b 0) EU: UT`  a ZU8 UT`  (gcd b (remainder a b)))) oU6 UT` p U4 UT`  HH<HHl <d<<HH< HH^   ` em+Alternative Rationalizing Implementation %` (n r4UT UT` (define (numer r) (car r)) (cIUR UT` UT ^UP UT` ca(define (denom r) (cdr r)) sUN UT`  UL UT` ) (define (make-rat n d) letUJ UT` (c (let ((g (gcd n d))) ` UH UT` x) (cons (/ n g) UF UT` UT (/ d g)))) mUD UT` UB TUB UT` on(define (gcd a b) U@ UT` UT (if (= b 0) U> UT` U< a 0U< UT` b (gcd b (remainder a b)))) EU: UT`  ZU8 UT` r  )HH<HHl _9h___-$9j-$)u-9k)u-2X 9l 2X 2Є2Є  fixed-pointion$9m $r) ar)$9nn(d$UN)J?~X 9o d)J?~X JJ  (lambda (y)` J?~X 9p FUTJ?~X JJ  (/ x y))`  9q a)  ÕÕ 1>9rb er b)?hl9s?hl9txRRm 9      I> II sqrt3Q\һ;9   3Q\һ;3Q\һ\һ*~0 9     3*~0 3B3B newton8~P 9    m8~P ABAB  -transform~\#?~aB$9   \~\#?~aB$ÕI9   ^~I  I\3` 9     3` ;Õ;Õ  of-transform~\#?~279     ^9~\#?~27 %t5p9     ^9%t5p Q\;9     ^Q\;  xP%6y 9     ^xP%6y   H\9     ^H\  xQ5Rm9  ^ ^xQ5Rm  HZv= I>  4lsq~=   ~l   ~=   ~on   UT UT` 1. Constructor ormUR UT` - ; make-register: Int, Int, Int, Int -> Reg 3UP UT`  (make-cash-register q d n p) HUN UT` I ]UL UT` 2. Accessors rUJ UT` ֯ ; num-quarters: Reg -> Int UH UT`  (num-quarters ) UF UT` 9 (num-dimes ) ... etc. UD UT`  ^UB UT` 5pLayered Operations U@ UT` (define (register-value reg) U> UT`  (+rat U< UT` xP0 (+rat (*rat (make-rat (num-quarters reg) 1) U: UT` (make-rat 1 4)) 9/U8 UT` - (*rat (make-rat (num-dimes reg) 1) DU6 UT` I" (make-rat 1 10))) YU4 UT` / (+rat (*rat (make-rat (num-nickels reg) 1) nU2 UT` ! (make-rat 1 20)) U0 UT` / (*rat (make-rat (num-pennies reg) 1) U. UT` % (make-rat 1 100))))) U, UT` rmImplementation U* UT` r:%(define (make-cash-register q d n p) U( UT` ca (list q d n p)) U& UT` /(define (num-quarters reg) (car reg)) ... etc. UTQ=      ,UHQ ?-=       , ?- . Q??Q?-=       , U@?-(dinQ?ZlQ=     ,P Qke-?-=   !   ! , ?- (me-Q??Q?-= ! "  " , ?-I Q?ZlQ= " ! #  ! # ,-t Q 1)?-= # " $  " $ , me-?- UTQ??Q?-= $ # %  # % , ?- (me-Q?ZlQ= % $ &  $ & ,:(dQreg?-= & % '  % ' , sq ?- Q?)?Q?-= ' & (  & ( , =?-UHQ)?)Zl?= ( ' )  ' ) ,?Q?Q?= ) ( *  ( * , ?-(d?Q?= * ) +  ) + ,? ?Q?= + * ,  * ,? (me-?Q?~-= , + -  "?~-  +l, h= - , .  l, hl!ul!u quarters-  h= . - /  =  h dimesT$ h= / . 0  $ h nickels;* h= 0 / 1  ;* h;%;% pennies-/= 1 0 2  '-/D-55ʺ @0{S>$ = 2 1 3  ($ $f-cؔ0jD"+= 4 3  "+-(d|"?;$FHH> 5 K6 6 j Lol.> 6 k 5l.l 7 7 + -l.> 7 5 l. hl 6 UT UT` h1. New Constructor UR UT` %(define (make-cash-register q d n p) 3UP UT` ) (list (make-coin-bag q (make-rat 1 4)) HUN UT` C el* (make-coin-bag d (make-rat 1 10)) ]UL UT` @ * (make-coin-bag n (make-rat 1 20)) rUJ UT` A - (make-coin-bag p (make-rat 1 100)))) UH UT` {S UF UT` %Operations as Part of Implementation UD UT` (define (coins-in-register reg) UB UT`  (define (helper bag-list) $U@ UT`  (cond ((null? bag-list) 0) "U> UT` . (else (+ (num-coins (car bag-list)) U< UT` / (helper (cdr bag-list)))))) U: UT`  (helper reg)) /U8 UT`  kDU6 UT`  YU4 UT` (define (register-value reg) nU2 UT`  (define (helper bag-list) U0 UT` , (cond ((null? bag-list) (make-rat 0 1)) U. UT` UT1 (else (+rat (bag-value (car bag-list)) U, UT` e-2 (helper (cdr bag-list)))))) U* UT` ( (helper reg)) UNU( UT` E  U& UT` ( eQ> 8 r 9 5 9 jme-Qrat?-> 9 8 : 5 8 : j -in?-1 1))Q??Q?-> : 9 ] 5 9 ] j len?- Q?ZlHZv> ; >lr  < @ Bm > < ? ;l = =  UT> = ; dbaUT  reg)) < UT UT` 1. Constructor ` UR UT` is* ; make-coin-bag: Int, RepRat -> CoinBag 3UP UT` st' (make-coin-bag ) l? HUN UT` t  )]UL UT` 2. Accessors rUJ UT` al (num-coins ) UTUH UT`  (coin-value ) rUF UT` U* TUD UT` elLayered Operations UB UT` UT(define (bag-value bag) U@ UT` 9% (*rat (make-rat (num-coins bag) 1) U> UT` > (coin-value bag))) ?d? > C C ]> ? n < @ ;D> @ ? ;lDl A A <D> A ; D  @ UT UT` Implementation UR UT`  3UP UT` ; CoinBag = Int X RepRat nHUN UT` UT ]UL UT`  -c)(define (make-coin-bag count coin-value) rUJ UT`  co (cons count coin-value)) l? UH UT`  t  )UF UT` #(define (num-coins bag) (car bag))  UD UT`  g>$(define (coin-value bag) (cdr bag)) e UB UT`  UT HH? B > patHH  ; bag) ; ; C    h umBag of Coinsm >HH? C >)HHl M B B d@ Kn @ M MH6@ L K H6 5 5 5 M  ?  h 'Cash Register - New Implementationo H6@ M KH6l C L L ;ccZZ@h Q R R pR;ccZZDccH-@i R Q Qme-DccH-in-lucϾcDccQ> ] : ^ 5 : ^ jHUTQUF?-> ^ ] _ 5 ] _ j c b?- Q??Q?-> _ ^ ` 5 ^ ` j ?-Q?ZlQ> ` _ a 5 _ a j Q ?-> a ` b 5 ` b j ?->Q??Q?-> b a c 5 a c j ?-KQ?ZlQ> c b d 5 b d jQH?-> d c e 5 c e j 5?- ?Q?)?Q?-> e d f 5 d f j ?-Q)?)Zl?> f e g 5 e g jc?@h?Q?> g f h 5 f h ji?e-c?Q?> h g i 5 g i j?UT?Q?> i h j 5 h jc b? ?Q?~-> j i 5 `?~- 8 il, h> k 6 l 5 l, hl!ul!u quarters  h> l k m 5 >  h dimes$ h> m l n 5 $ h nickels;* h> n m o 5 ;* h;%;% pennies-/> o n p 5 e-/D-55ʺ @0{S>$ > p o q 5 f$ $f-cؔ q p r 5 g$)#,>0jD"+> r q 8 5i"+e-c|"?;$Fd5Leftd6Rightd7c ReferencedDdaddddh>dd did ndd hd  > d  K a s!f a THeading1Body. f b  Bulleted\t8. f c CellBody. f d  CellHeading. f e  Footnote. nf fTHeading1Body. f gT Heading2Body. f hT  HeadingRunInBody. f i l yIndented. f j  Scheme. f kE o o Numbered1.\tNumbered. f l dy TableFootnote. f mT  TableTitleT:Table : .  f nPTitleBody. f o T  TableTitleT:Table : . f p   CellHeading. f q  CellBody. f r   CellFooting. @ t  blaHeader. @ u  oFooter. f w Scheme. f x  Body. f z  Scheme. 33 f { ot33. Numbered.\t. f | T Heading1ContBody. f }T Heading1ContBody. f ~   Scheme. f Scheme. . f  Body. f  Scheme. erf   Scheme. f  HighlightNumber. f  HighlightNumber .  Emphasis EquationVariables                    m F F F F F  F F  F F F F F F b F f  F n F  Thin Medium  Double Thick@  Very Thin     oH p q rH p q rH p q rH p q rH p q rFormat A   oH p q rH p q rH p q rH p q rH p q rFormat B U e V UComment d BlackT!WhiteddAReddd Greendd  Blued Cyand Magentad Yellow M.Arial Rounded MT Bold.B M.Times.Pn Times-Roman M.Times.Bm Times-Bold M.Courier.Bb Courier-Bold M.Arial.PhArialMT M.Courier.BICourier-BoldOblique M.Courier.PCourierM.Arial Rounded MT Bold.PArialRoundedMTBold M.Helvetica.BHelvetica-BoldArial MonotypeArial Rounded Monotype Bold Courier Helvetica TimesRegularRomanMediumBoldedBold RegularObliqueItalicjʈ+2k1ɒcWV(z;R~xI%j1|lŚM9eM)