#reader(lib"read.ss""wxme")WXME0108 ## #| This file uses the PLT Scheme editor format. Open this file in DrScheme version 4.2.3 or later to read it. Most likely, it was created by saving a program in DrScheme, and it probably contains a program with non-text elements (such as images or comment boxes). http://www.plt-scheme.org |# 28 7 #"wxtext\0" 3 1 6 #"wxtab\0" 1 1 8 #"wxmedia\0" 4 1 8 #"wximage\0" 2 0 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0" 1 0 16 #"drscheme:number\0" 3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0" 1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0" 1 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" 0 0 19 #"drscheme:sexp-snip\0" 0 0 40 #"(lib \"image-core.ss\" \"2htdp\" \"private\")\0" 1 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" 1 0 33 #"(lib \"bullet-snip.ss\" \"browser\")\0" 0 0 29 #"drscheme:bindings-snipclass%\0" 1 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" 1 0 22 #"drscheme:lambda-snip%\0" 1 0 56 #"(lib \"hrule-snip.ss\" \"macro-debugger\" \"syntax-browser\")\0" 1 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0" 1 0 26 #"drscheme:pict-value-snip%\0" 0 0 38 #"(lib \"pict-snipclass.ss\" \"slideshow\")\0" 2 0 55 #"(lib \"vertical-separator-snip.ss\" \"stepper\" \"private\")\0" 1 0 18 #"drscheme:xml-snip\0" 1 0 31 #"(lib \"xml-snipclass.ss\" \"xml\")\0" 1 0 21 #"drscheme:scheme-snip\0" 2 0 34 #"(lib \"scheme-snipclass.ss\" \"xml\")\0" 1 0 10 #"text-box%\0" 1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0" 1 0 15 #"test-case-box%\0" 2 0 1 6 #"wxloc\0" 0 0 72 0 1 #"\0" 0 75 1 #"\0" 0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9 #"Standard\0" 0 75 17 #"Courier New Bold\0" 0 22 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24 #"framework:default-color\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15 #"text:ports out\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 150 0 150 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 15 #"text:ports err\0" 0 -1 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17 #"text:ports value\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 0 0 175 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 27 #"Matching Parenthesis Style\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:symbol\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:keyword\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 3 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:comment\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 3 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:string\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 41 128 38 0 0 0 -1 -1 2 39 #"framework:syntax-color:scheme:constant\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 41 128 38 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 132 60 36 0 0 0 -1 -1 2 42 #"framework:syntax-color:scheme:parenthesis\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 132 60 36 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:error\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:other\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 81 112 203 0 0 0 -1 -1 2 38 #"drscheme:check-syntax:lexically-bound\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 81 112 203 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 #"drscheme:check-syntax:set!d\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 68 0 203 0 0 0 -1 -1 2 31 #"drscheme:check-syntax:imported\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 68 0 203 0 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0 1.0 65 105 225 0 0 0 -1 -1 24 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 255 165 0 0 0 0 -1 -1 24 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 15 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 255 165 0 0 0 0 -1 -1 17 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 255 165 0 0 0 0 -1 -1 24 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 17 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 0 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 0 -1 0 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 200 0 0 0 0 0 -1 -1 18 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 255 165 0 0 0 0 -1 -1 0 372 0 4 3 85 ( #";; The first three lines of this file were inserted by DrScheme. The" #"y record metadata" ) 0 0 4 29 1 #"\n" 0 0 4 3 85 ( #";; about the language level of this file in a form that our tools ca" #"n easily process." ) 0 0 4 29 1 #"\n" 0 0 4 3 367 ( #"#reader(lib \"htdp-beginner-reader.ss\" \"lang\")((modname 130lab03-" #"projected) (read-case-sensitive #t) (teachpacks ((lib \"fabric-teach" #"pack.scm\" \"installed-teachpacks\") (lib \"universe.ss\" \"teachpac" #"k\" \"2htdp\"))) (htdp-settings #(#t constructor repeating-decimal #" #"f #t none #f ((lib \"fabric-teachpack.scm\" \"installed-teachpacks\"" #") (lib \"universe.ss\" \"teachpack\" \"2htdp\")))))" ) 0 0 4 29 1 #"\n" 0 0 17 3 39 #"; CIS 130 - Week 3, Wednesday, 02-03-10" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 4 3 1 #" " 0 0 14 3 13 #"MAX-SAFE-TEMP" 0 0 4 3 1 #" " 0 0 20 3 3 #"120" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 14 3 13 #"MAX-SAFE-TEMP" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 367 4 0 0 0 60 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 14 3 6 #"color1" 0 0 2 3 1 #" " 0 0 14 3 6 #"color2" 0 0 22 3 1 #")" 0 0 2 3 3 #" " 0 0 17 3 26 #"; first line of a function" 0 0 2 29 1 #"\n" 0 0 2 3 43 #" " 0 0 17 3 26 #"; definition is its HEADER" 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 17 3 63 #"; the expression after the header is called the function's BODY" 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"add-horiz-stripe" 0 0 2 3 1 #" " 0 0 14 3 6 #"color1" 0 0 2 3 1 #" " 0 0 20 3 2 #"10" 0 0 2 29 1 #"\n" 0 0 2 3 20 #" " 0 0 22 3 1 #"(" 0 0 14 3 19 #"create-solid-fabric" 0 0 2 3 1 #" " 0 0 14 3 6 #"color2" 0 0 2 3 1 #" " 0 0 20 3 3 #"100" 0 0 2 3 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 2 #"))" 0 0 2 29 1 #"\n" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 2 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"green\"" 0 0 2 3 1 #" " 0 0 18 3 8 #"\"yellow\"" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 18 3 8 #"\"purple\"" 0 0 2 3 1 #" " 0 0 18 3 8 #"\"orange\"" 0 0 22 3 1 #")" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 54 #"; color1 and color2 are the PARAMETERS of the function" 0 0 4 29 1 #"\n" 0 0 17 3 22 #"; make-striped-box;" 0 0 4 29 1 #"\n" 0 0 17 3 52 #"; when I use make-striped-box, I need to give it two" 0 0 4 29 1 #"\n" 0 0 17 3 62 #"; ARGUMENT expressions, and the values of those expressions" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; become the values of those parameters for that call" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 59 #"; and now I can used a make-striped-box expression anywhere" 0 0 4 29 1 #"\n" 0 0 17 3 34 #"; I can use an image expression" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 145 4 0 0 0 23 0 22 3 1 #"(" 0 0 14 3 12 #"image-height" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"black\"" 0 0 2 3 1 #" " 0 0 18 3 8 #"\"yellow\"" 0 0 22 3 2 #"))" 0 0 2 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 9 #"add-print" 0 0 2 3 1 #" " 0 0 14 3 5 #"chili" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"black\"" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"white\"" 0 0 22 3 2 #"))" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 51 #"; if I wanted to TEST make-striped-box, I could use" 0 0 4 29 1 #"\n" 0 0 17 3 55 #"; check-expect to compare the call's actual value to" 0 0 4 29 1 #"\n" 0 0 17 3 32 #"; the value I EXPECT it to be" 0 0 4 29 1 #"\n" 0 0 17 3 54 #"; (it isn't a good test unless you think you know what" 0 0 4 29 1 #"\n" 0 0 17 3 19 #"; it should do!)" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 19 #"; have you noticed:" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; ...when describing an operation/function, we have been" 0 0 4 29 1 #"\n" 0 0 17 3 45 #"; taking care to describe what it EXPECTS," 0 0 4 29 1 #"\n" 0 0 17 3 26 #"; and what it PRODUCES?" 0 0 4 29 1 #"\n" 0 0 17 3 54 #"; we'll ALWAYS do that, when designing a new function," 0 0 4 29 1 #"\n" 0 0 17 3 52 #"; and we'll always need to know that when we want" 0 0 4 29 1 #"\n" 0 0 17 3 26 #"; to use some function;" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 57 #"; here is another simple function: to compute the area of" 0 0 4 29 1 #"\n" 0 0 17 3 16 #"; a rectangle" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 133 4 0 0 0 21 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 2 3 1 #" " 0 0 14 3 6 #"length" 0 0 2 3 1 #" " 0 0 14 3 5 #"width" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 22 3 1 #"(" 0 0 14 3 1 #"*" 0 0 2 3 1 #" " 0 0 14 3 6 #"length" 0 0 2 3 1 #" " 0 0 14 3 5 #"width" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 22 3 1 #")" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 97 4 0 0 0 15 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 2 3 1 #" " 0 0 20 3 2 #"40" 0 0 2 3 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 2 3 1 #" " 0 0 20 3 1 #"3" 0 0 2 3 1 #" " 0 0 20 3 1 #"5" 0 0 22 3 1 #")" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 241 4 0 0 0 39 0 22 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 2 3 1 #" " 0 0 20 3 1 #"3" 0 0 2 3 1 #" " 0 0 20 3 1 #"5" 0 0 22 3 1 #")" 0 0 2 3 1 #" " 0 0 20 3 2 #"15" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 17 3 65 #";(check-expect (rect-area (/ 1 3) 2) 0.66667) ; this test fails" 0 0 2 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 12 #"check-within" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 1 #"/" 0 0 2 3 1 #" " 0 0 20 3 1 #"1" 0 0 2 3 1 #" " 0 0 20 3 1 #"3" 0 0 22 3 1 #")" 0 0 2 3 1 #" " 0 0 20 3 1 #"2" 0 0 22 3 1 #")" 0 0 2 3 1 #" " 0 0 20 3 7 #"0.66667" 0 0 2 3 1 #" " 0 0 20 3 4 #".001" 0 0 22 3 1 #")" 0 0 2 3 1 #" " 0 0 17 3 15 #"; this succeeds" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 181 4 0 0 0 29 0 22 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 18 3 6 #"\"pink\"" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"green\"" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 2 3 14 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"add-horiz-stripe" 0 0 2 3 1 #" " 0 0 18 3 6 #"\"pink\"" 0 0 2 3 1 #" " 0 0 20 3 2 #"10" 0 0 2 29 1 #"\n" 0 0 2 3 32 #" " 0 0 22 3 1 #"(" 0 0 14 3 19 #"create-solid-fabric" 0 0 2 3 1 #" " 0 0 18 3 7 #"\"green\"" 0 0 2 3 1 #" " 0 0 20 3 3 #"100" 0 0 2 3 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 3 #")))" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 27 #";(make-striped-box \"green\")" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; not all functions are designed as easily as rect-area!" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; to help us get started, we'll be using DESIGN RECIPES," 0 0 4 29 1 #"\n" 0 0 17 3 51 #"; step-by-step approaches to designing functions" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 59 #"; we'll start with a simple version (for simple functions)," 0 0 4 29 1 #"\n" 0 0 17 3 28 #"; and add steps later on;" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 47 #"; STEP 1 - problem analysis and data definition" 0 0 4 29 1 #"\n" 0 0 17 3 34 #"; STEP 2 - CONTRACT/PURPOSE/HEADER" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 21 #"; what is a contract?" 0 0 4 29 1 #"\n" 0 0 17 3 31 #"; a special comment containing:" 0 0 4 29 1 #"\n" 0 0 17 3 43 #"; the NAME of the function to be written" 0 0 4 29 1 #"\n" 0 0 17 3 45 #"; the TYPES of expressions it EXPECTS, and" 0 0 4 29 1 #"\n" 0 0 17 3 44 #"; the TYPE of value it PRODUCES (returns)" 0 0 4 29 1 #"\n" 0 0 17 3 16 #"; written as so:" 0 0 4 29 1 #"\n" 0 0 17 3 49 #"; contract: funct-name: type type .. type -> type" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 52 #"; contract: make-striped-box: string string -> image" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 46 #"; contract: rect-area: number number -> number" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 49 #"; next: create the PURPOSE (or PURPOSE STATEMENT)" 0 0 4 29 1 #"\n" 0 0 17 3 58 #"; notice how the contract doesn't DESCRIBE those values" 0 0 4 29 1 #"\n" 0 0 17 3 29 #"; it expects and produces?" 0 0 4 29 1 #"\n" 0 0 17 3 63 #"; ...now, you ADD this description in the PURPOSE statement," 0 0 4 29 1 #"\n" 0 0 17 3 59 #"; a comment that DESCRIBES what this function EXPECTS" 0 0 4 29 1 #"\n" 0 0 17 3 53 #"; and what it PRODUCES (returns)" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 25 #"; for make-striped-box..." 0 0 4 29 1 #"\n" 0 0 17 3 55 #"; purpose: expects two colors, and produces a box image" 0 0 4 29 1 #"\n" 0 0 17 3 55 #"; of size 100x100 pixels with stripes of width" 0 0 4 29 1 #"\n" 0 0 17 3 40 #"; 10 pixels of those two colors" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 18 #"; for rect-area..." 0 0 4 29 1 #"\n" 0 0 17 3 58 #"; purpose: expects a length and a width of some rectangle," 0 0 4 29 1 #"\n" 0 0 17 3 50 #"; and produces the area of that rectangle" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 26 #"; now, write the HEADER..." 0 0 4 29 1 #"\n" 0 0 17 3 57 #"; (and DrScheme permits you to put ... as a \"placeholder\"" 0 0 4 29 1 #"\n" 0 0 17 3 59 #"; for the function body, until you're ready to write it)" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 7 97 4 0 0 0 15 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 2 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 2 3 1 #" " 0 0 14 3 6 #"color1" 0 0 2 3 1 #" " 0 0 14 3 6 #"color2" 0 0 22 3 1 #")" 0 0 2 29 1 #"\n" 0 0 2 3 2 #" " 0 0 14 3 3 #"..." 0 0 2 29 1 #"\n" 0 0 22 3 1 #")" 0 0 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; STEP 3 - develop SPECIFIC EXAMPLES, written as check-*" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; expressions, for each \"kind\" of data/situation this" 0 0 4 29 1 #"\n" 0 0 17 3 24 #"; function can handle" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 4 3 1 #" " 0 0 18 3 6 #"\"pink\"" 0 0 4 3 1 #" " 0 0 18 3 7 #"\"green\"" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 3 14 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"add-horiz-stripe" 0 0 4 3 1 #" " 0 0 18 3 6 #"\"pink\"" 0 0 4 3 1 #" " 0 0 20 3 2 #"10" 0 0 4 29 1 #"\n" 0 0 4 3 32 #" " 0 0 22 3 1 #"(" 0 0 14 3 19 #"create-solid-fabric" 0 0 4 3 1 #" " 0 0 18 3 7 #"\"green\"" 0 0 4 3 1 #" " 0 0 20 3 3 #"100" 0 0 4 11 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 3 #")))" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 4 3 1 #" " 0 0 18 3 6 #"\"blue\"" 0 0 4 3 1 #" " 0 0 18 3 8 #"\"purple\"" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 3 14 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"add-horiz-stripe" 0 0 4 3 1 #" " 0 0 18 3 6 #"\"blue\"" 0 0 4 3 1 #" " 0 0 20 3 2 #"10" 0 0 4 29 1 #"\n" 0 0 4 3 32 #" " 0 0 22 3 1 #"(" 0 0 14 3 19 #"create-solid-fabric" 0 0 4 3 1 #" " 0 0 18 3 8 #"\"purple\"" 0 0 4 3 1 #" " 0 0 20 3 3 #"100" 0 0 4 11 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 3 #")))" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 4 3 1 #" " 0 0 20 3 1 #"3" 0 0 4 3 1 #" " 0 0 20 3 1 #"5" 0 0 22 3 1 #")" 0 0 4 3 1 #" " 0 0 20 3 2 #"15" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 14 3 12 #"check-within" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 1 #"/" 0 0 4 3 1 #" " 0 0 20 3 1 #"1" 0 0 4 3 1 #" " 0 0 20 3 1 #"3" 0 0 22 3 1 #")" 0 0 4 3 1 #" " 0 0 20 3 1 #"2" 0 0 22 3 1 #")" 0 0 4 3 1 #" " 0 0 20 3 7 #"0.66667" 0 0 4 3 1 #" " 0 0 20 3 4 #".001" 0 0 22 3 1 #")" 0 0 4 3 1 #" " 0 0 17 3 15 #"; this succeeds" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 5 #";STEP" 0 0 17 3 1 #" " 0 0 17 3 1 #"4" 0 0 17 3 1 #" " 0 0 17 3 1 #"-" 0 0 17 3 1 #" " 0 0 17 3 8 #"skipping" 0 0 17 3 1 #" " 0 0 17 3 3 #"for" 0 0 17 3 1 #" " 0 0 17 3 3 #"now" 0 0 17 3 1 #" " 0 0 17 3 2 #"--" 0 0 17 3 1 #" " 0 0 17 3 1 #"(" 0 0 17 3 3 #"use" 0 0 17 3 1 #" " 0 0 17 3 1 #"a" 0 0 17 3 1 #" " 0 0 17 3 8 #"TEMPLATE" 0 0 17 3 1 #" " 0 0 17 3 2 #"if" 0 0 17 3 1 #" " 0 0 17 3 5 #"there" 0 0 17 3 1 #" " 0 0 17 3 7 #"one for" 0 0 4 29 1 #"\n" 0 0 17 3 18 #"; your situation" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 46 #";STEP 5 - develop/complete the function's body" 0 0 4 29 1 #"\n" 0 0 17 3 56 #"; (using what you've learned from writing the specific" 0 0 4 29 1 #"\n" 0 0 17 3 13 #"; examples)" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 9 #"rect-area" 0 0 4 3 1 #" " 0 0 14 3 6 #"length" 0 0 4 3 1 #" " 0 0 14 3 5 #"width" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 3 2 #" " 0 0 22 3 1 #"(" 0 0 14 3 1 #"*" 0 0 4 3 1 #" " 0 0 14 3 6 #"length" 0 0 4 3 1 #" " 0 0 14 3 5 #"width" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 3 2 #" " 0 0 4 29 1 #"\n" 0 0 22 3 1 #"(" 0 0 15 3 6 #"define" 0 0 4 3 1 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"make-striped-box" 0 0 4 3 1 #" " 0 0 14 3 6 #"color1" 0 0 4 3 1 #" " 0 0 14 3 6 #"color2" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 3 2 #" " 0 0 22 3 1 #"(" 0 0 14 3 16 #"add-horiz-stripe" 0 0 4 3 1 #" " 0 0 14 3 6 #"color1" 0 0 4 3 1 #" " 0 0 20 3 2 #"10" 0 0 4 29 1 #"\n" 0 0 4 3 20 #" " 0 0 22 3 1 #"(" 0 0 14 3 19 #"create-solid-fabric" 0 0 4 3 1 #" " 0 0 14 3 6 #"color2" 0 0 4 3 1 #" " 0 0 20 3 3 #"100" 0 0 4 3 1 #" " 0 0 20 3 3 #"100" 0 0 22 3 2 #"))" 0 0 4 29 1 #"\n" 0 0 22 3 1 #")" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 17 3 25 #"; STEP 6 - run the tests!" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0 4 29 1 #"\n" 0 0