Exercise2.3 Implementarepresentationforrectanglesinaplane.(Hint:YoumaywanttomakeuseofExercise2.2.)Intermsofyourconstructorsandselectors,createproceduresthatcomputetheperimeterandtheareaofagivenrectangle.Nowimplementadifferentrepresentationforrectangles.Canyoudesignyoursystemwithsuitableabstractionb...
Exercise1.45 WesawinSection1.3.3thatattemptingtocomputesquarerootsbynaivelyfindingafixedpointofy->x/ydoesnotconverge,andthatthiscanbefixedbyaveragedamping.Thesamemethodworksforfindingcuberootsasfixedpointsoftheaverage-dampedyx/y^2.Unfortunately,theprocessdoesnotworkforfourthroots—asingleaveraged...
Exercise2.1 Exercise2.1:Defineabetterversionofmake-ratthathandlesbothpositiveandnegativearguments.make-ratshouldnormalizethesignsothatiftherationalnumberispositive,boththenumeratoranddenominatorarepositive,andiftherationalnumberisnegative,onlythenumeratorisnegative. 第一章学完了,今天开始学习第二章,目前还没有遇到什么问题,...