WXME0107 ## .wxtextwxtabwxmediawximage"(lib "syntax-browser.ss" "mrlib")drscheme:number$(lib "comment-snip.ss" "framework")+(lib "collapsed-snipclass.ss" "framework")drscheme:sexp-snip!(lib "bullet-snip.ss" "browser")drscheme:bindings-snipclass%$(lib "cache-image-snip.ss" "mrlib")drscheme:lambda-snip%java-comment-box%java-interactions-box%gb:core gb:canvasgb:editor-canvas gb:slider gb:gauge gb:listbox gb:radiobox gb:choicegb:text gb:message gb:button gb:checkboxgb:vertical-panel gb:panelgb:horizontal-panel!(lib "readable.ss" "guibuilder")make-line-snipmake-line-snip example-box%interactions-box%-(lib "image-snipr.ss" "slideshow" "private")drscheme:pict-value-snip%&(lib "pict-snipclass.ss" "slideshow")"drscheme:vertical-separator-snip%wxbaddrscheme:xml-snip(lib "xml-snipclass.ss" "xml")drscheme:scheme-snip"(lib "scheme-snipclass.ss" "xml")test-case-box% text-box%wxloc9K ZÁÿZÁÿÁÿ€ÿ€ÿ€ÿÁÿ StandardK Andale Mono ZÁÿZÁÿÁÿ€ÿ€ÿ€ÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿframework:default-colorÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿÁÿ?ð\ÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿMatching Parenthesis StyleÁÿ?ð\ÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð&&€€ÁÿÁÿ(framework:syntax-coloring:scheme:symbolÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð&&€€ÁÿÁÿ)framework:syntax-coloring:scheme:keywordÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð&&€€ÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÂtÁÿÁÿ)framework:syntax-coloring:scheme:commentÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÂtÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð)€€&ÁÿÁÿ(framework:syntax-coloring:scheme:stringÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð)€€&ÁÿÁÿ*framework:syntax-coloring:scheme:constantÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð)€€&ÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€„<$ÁÿÁÿ-framework:syntax-coloring:scheme:parenthesisÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€„<$ÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿ'framework:syntax-coloring:scheme:errorÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿ'framework:syntax-coloring:scheme:otherÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿ%profj:syntax-coloring:scheme:keywordÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿ$profj:syntax-coloring:scheme:stringÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿ%profj:syntax-coloring:scheme:literalÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿ%profj:syntax-coloring:scheme:commentÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÂtÁÿÁÿ#profj:syntax-coloring:scheme:errorÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿ(profj:syntax-coloring:scheme:identifierÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð&&€€ÁÿÁÿ%profj:syntax-coloring:scheme:defaultÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðQp€ËÁÿÁÿ1drscheme:check-syntax:lexically-bound-identifierÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðQp€ËÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðD€ËÁÿÁÿ*drscheme:check-syntax:imported-identifierÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðD€ËÁÿÁÿ$honu:syntax-coloring:scheme:keywordÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿ(honu:syntax-coloring:scheme:parenthesisÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€„<$ÁÿÁÿ#honu:syntax-coloring:scheme:stringÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿ$honu:syntax-coloring:scheme:literalÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð"€‹"ÁÿÁÿ$honu:syntax-coloring:scheme:commentÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÂtÁÿÁÿ"honu:syntax-coloring:scheme:errorÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿ'honu:syntax-coloring:scheme:identifierÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð&&€€ÁÿÁÿ$honu:syntax-coloring:scheme:defaultÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðÁÿÁÿF?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿXMLF?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€–€–ÁÿÁÿÁÿ?ðÁÿÁÿ]ÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€¯ÁÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðdÁÿÁÿK?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðdÁÿÁÿK Andale Mono ZÁÿZÁÿÁÿ€ÿ€ÿ€ÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð?ð?ð?ðÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÿÁÿÁÿG?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ðdÁÿÁÿÁÿ?ðÁÿÁÿÁÿÁÿÁÿÁÿ?ð?ð?ð€ÈÁÿÁÿ,Ž\/* Review      (1) Counting fish in a catch    (2) Summing weights of fish in a catch    (3) "Folding" over Theme Park lists    (4) Evaluating over expression trees     Concatenating last names in family tree    Computing the total number of kids associated with a family tree    Computing the total number of persons in a family with a given name     (5) Functional delete on a (shopping) list    (6) Inserting into a sorted list  (7) Sorting lists    (8) Appending lists     Tips for writing methods:    * Types are your friends. Don't ignore them.          e.g. return new Fish(5) not return 5 if the method is Fish makeBigFish()    * Consider your method's purpose. If the purpose is too vague or is inconsistent       with the problem statement, then rewrite the purpose.         o To determine if/whether ... ==> if ... else ...  conditional?         o To calculate/compute the ... amount ==> arithmetic         o ... with a given ... ==> Use a parameter?  A A Maybe call another method on the parameter or an if...else that  A       depends on a parameter-including expression             * The result's type and description in the purpose should give you a good idea      what you should be returning.    * If you are writing a method for a recursive data structure, the n remember       to consider whether you need a recursive call.          e.g. Telephone...shopping list ==> Where can the carrot possibly be?  A       The data type List gives two options: front and rest.               List insertion ==> I have a new Object to insert into the list... A            where can I possibly insert it?              Tree ==> I want to evaluate an expression. Before I can evaluate the                 final expression, what parts could I possibly have to evaluate  A A      beforehand?    * The method is supposed to operate on the data represented in a class hierarchy,       hence the method should reflect in some way the structure of the data.    * DRAW BIG PICTURES (tip from physics) or at least use pencil & paper to work through        a computation by hand!        You can graphically visualize many data structures. Be sure that you understand the        data structure before writing any methods for it.     * Your examples should play devil's advocate, testing out the borderline and tough cases.      If there are any cases with which you are unclear, perhaps you should think a little       more before writing the method.  */  abstract class IntList {  // To produce an IntList which has the same ints as this IntList except in reverse order A abstract IntList reverse(); A // To append another IntList to the end of this IntList A abstract IntList append(IntList list); }  class EmptyIntList extends IntList { A EmptyIntList() {}  A // new EmptyIntList().reverse() -> new EmptyIntList()  A // To produce an IntList which has the same ints as this EmptyIntList except in reverse order A IntList reverse() { A A // ... A A return this; A }  A // new EmptyIntList().append(new EmptyIntList()) -> new EmptyIntList() A // new EmptyIntList().append(new LargerIntList(3, new LargerIntList(4, new Empty IntList()))) ->  A //A new LargerIntList(3, new LargerIntList(4, new Empty IntList()))) A // To produce an IntList which is another IntList appended to the end of this EmptyIntList A IntList append(IntList list) { A A // ... list ... A A return list; A } }  class LargerIntList extends IntList { A int front; A IntList rest;  A  LargerIntList(int front, IntList rest) { A A this.front = front; A A this.rest = rest; A }  A // To produce an IntList which has the same ints as this LargerIntList except in reverse order A IntList reverse() { A A // ... this.front ... this.rest.IntListMethod() ... A A return this.rest.reverse().append(new LargerIntList(this.front, new EmptyIntList())); A } A  A // new  LargerIntList(1,   A // A new  LargerIntList(3,   // A  new  LargerIntList(5,   // A  new EmptyIntList()))).append(new  LargerIntList(8, A // A A A A A A A new EmptyIntList())) -> A // new  LargerIntList(1,   // A new LargerIntList(3,   // A  new  LargerIntList(5,   // new  LargerIntList(8,  // new  EmptyIntList())))) A // To produce a new IntList which is another IntList appended to the end of this LargerIntList A IntList append(IntList list) { A A // ... this.front ... this.rest.IntListMethod() ... list ... A A return new LargerIntList(this.front, this.rest.append(list)); A } } ,N,new  LargerIntList(1,   new  LargerIntList(3,   new  LargerIntList(5,   new  EmptyIntList()))).append(new  LargerIntList(8, new  EmptyIntList()))'new  LargerIntList(1,   new  LargerIntList(3,   new  LargerIntList(5,   new  LargerIntList(8,  new  EmptyIntList())))) ,ù(new  LargerIntList(1,   new  LargerIntList(3,   new  LargerIntList(5,   new EmptyIntList()))).reverse()0new LargerIntList(5,   new  LargerIntList(3,   new LargerIntList(1, new EmptyIntList()))) ,Pnew EmptyIntList().reverse()new EmptyIntList() ,ˆLnew LargerIntList(4,   new  LargerIntList(3,   new  LargerIntList(2,   new  LargerIntList(1,   new EmptyIntList())))).reverse()Cnew LargerIntList(1,   new  LargerIntList(2,   new  LargerIntList(3,   new  LargerIntList(4,   new EmptyIntList()))))