#reader(lib"read.ss""wxme")WXME0108 ## #| This file uses the GRacket editor format. Open this file in DrRacket version 6.4 or later to read it. Most likely, it was created by saving a program in DrRacket, and it probably contains a program with non-text elements (such as images or comment boxes). http://racket-lang.org/ |# 32 7 #"wxtext\0" 3 1 6 #"wxtab\0" 1 1 8 #"wximage\0" 2 0 8 #"wxmedia\0" 4 1 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 93 ( #"((lib \"collapsed-snipclass.ss\" \"framework\") (lib \"collapsed-sni" #"pclass-wxme.ss\" \"framework\"))\0" ) 0 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" 0 0 19 #"drscheme:sexp-snip\0" 0 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" 1 0 68 ( #"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr" #"lib\"))\0" ) 1 0 29 #"drscheme:bindings-snipclass%\0" 1 0 101 ( #"((lib \"ellipsis-snip.rkt\" \"drracket\" \"private\") (lib \"ellipsi" #"s-snip-wxme.rkt\" \"drracket\" \"private\"))\0" ) 2 0 88 ( #"((lib \"pict-snip.rkt\" \"drracket\" \"private\") (lib \"pict-snip.r" #"kt\" \"drracket\" \"private\"))\0" ) 0 0 34 #"(lib \"bullet-snip.rkt\" \"browser\")\0" 0 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" 1 0 22 #"drscheme:lambda-snip%\0" 1 0 29 #"drclickable-string-snipclass\0" 0 0 26 #"drracket:spacer-snipclass\0" 0 0 57 #"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0" 1 0 26 #"drscheme:pict-value-snip%\0" 0 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0" 1 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 1 6 #"wxloc\0" 0 0 84 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 14 #"Operator Mono\0" 0 20 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 1 0 0 0 0 0 0 59 117 140 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 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 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 219 123 85 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 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 205 63 69 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 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 85 181 219 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 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:symbol\0" 0 -1 1 #"\0" 1 0 90 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 85 181 219 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:keyword\0" 0 -1 1 #"\0" 1 0 90 -1 90 -1 -1 -1 1 0 0 0 0 0 0 0 0 1 1 1 160 116 196 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:comment\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 123 147 155 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:string\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 159 202 86 0 0 0 -1 -1 2 35 #"framework:syntax-color:scheme:text\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 59 117 140 0 0 0 -1 -1 2 39 #"framework:syntax-color:scheme:constant\0" 0 -1 1 #"\0" 1 0 90 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 219 123 85 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 49 #"framework:syntax-color:scheme:hash-colon-keyword\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 85 219 190 0 0 0 -1 -1 2 42 #"framework:syntax-color:scheme:parenthesis\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 65 83 91 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:error\0" 0 -1 1 #"\0" 1 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 205 63 69 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:other\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 59 117 140 0 0 0 -1 -1 2 16 #"Misspelled Text\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 205 63 69 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 38 #"drracket:check-syntax:lexically-bound\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 85 219 190 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 #"drracket: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 159 202 86 0 0 0 -1 -1 2 37 #"drracket:check-syntax:unused-require\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 205 63 69 0 0 0 -1 -1 2 36 #"drracket:check-syntax:free-variable\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 160 116 196 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31 #"drracket:check-syntax:imported\0" 0 -1 1 #"\0" 1 0 90 -1 90 -1 -1 -1 1 0 0 0 0 0 0 0 0 1 1 1 85 181 219 0 0 0 -1 -1 2 47 #"drracket:check-syntax:my-obligation-style-pref\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 219 123 85 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50 #"drracket:check-syntax:their-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 90 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 159 202 86 0 0 0 -1 -1 2 48 #"drracket:check-syntax:unk-obligation-style-pref\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 205 63 69 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 49 #"drracket:check-syntax:both-obligation-style-pref\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 138 85 63 0 0 0 -1 -1 2 26 #"plt:htdp:test-coverage-on\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 159 202 86 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 27 #"plt:htdp:test-coverage-off\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 205 63 69 0 0 0 -1 -1 4 1 #"\0" 0 70 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 -1 -1 4 4 #"XML\0" 0 70 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 -1 -1 2 37 #"plt:module-language:test-coverage-on\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 159 202 86 0 0 0 -1 -1 2 38 #"plt:module-language:test-coverage-off\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 205 63 69 0 0 0 -1 -1 4 1 #"\0" 0 71 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 -1 -1 4 1 #"\0" 0 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 0.0 1.0 1.0 1.0 65 105 225 0 0 0 -1 -1 0 627 0 4 3 85 ( #";; The first three lines of this file were inserted by DrRacket. 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 261 ( #"#reader(lib \"htdp-advanced-reader.ss\" \"lang\")((modname imperativ" #"e-recitation) (read-case-sensitiv" #"e #t) (teachpacks ((lib \"image.ss\" \"teachpack\" \"htdp\"))) (htdp" #"-settings #(#t constructor repeating-decimal #t #t none #f ((lib \"i" #"mage.ss\" \"teachpack\" \"htdp\")) #f)))" ) 0 0 4 29 1 #"\n" 0 0 17 3 52 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 24 29 1 #"\n" 0 0 17 3 51 #"; Imperative Programming vs. Functional Programming" 0 0 24 29 1 #"\n" 0 0 17 3 52 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 49 #"; Vending machines (functions) can do two things:" 0 0 24 29 1 #"\n" 0 0 17 3 39 #"; 1. RETURN items, after taking payment" 0 0 24 29 1 #"\n" 0 0 17 3 59 #"; 2. Cause CHANGES (\"side effects\") - decreasing the stock," 0 0 24 29 1 #"\n" 0 0 17 3 41 #"; increasing the stored amount of profits" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 53 #"; Functional-style programs only do (1) and never (2)" 0 0 24 29 1 #"\n" 0 0 17 3 52 #"; Imperative-style programs can do (1), (2), or both" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 7 49 4 0 0 0 7 0 17 3 63 #"; Suppose we have a vending machine with the following options:" 0 0 24 29 1 #"\n" 0 0 17 3 23 #"; $1 -------- twix bars" 0 0 24 29 1 #"\n" 0 0 17 3 24 #"; $2 ------------ chips " 0 0 24 29 1 #"\n" 0 0 17 3 23 #"; $3 ------- beef jerky" 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 20 #"; FUNCTIONAL EXAMPLE" 0 0 24 29 1 #"\n" 0 0 17 3 34 #"; vend: number -> string or number" 0 0 24 29 1 #"\n" 0 0 17 3 87 ( #"; returns the item whose cost matches the payment, or returns paymen" #"t if no match found" ) 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 4 #"vend" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 4 #"cond" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 4 #") " 0 0 19 3 6 #"\"twix\"" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 3 #") " 0 0 19 3 7 #"\"chips\"" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 3 #") " 0 0 19 3 7 #"\"jerky\"" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" [" 0 0 14 3 4 #"else" 0 0 24 3 11 #" " 0 0 14 3 7 #"payment" 0 0 24 3 3 #"]))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 24 3 2 #" (" 0 0 14 3 4 #"vend" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 2 #") " 0 0 19 3 6 #"\"twix\"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 24 3 2 #" (" 0 0 14 3 4 #"vend" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 2 #") " 0 0 21 3 1 #"5" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 62 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 7 37 4 0 0 0 5 0 24 3 1 #"(" 0 0 14 3 4 #"void" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 17 3 14 #"; does nothing" 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 66 #"; If a function doesn't return any values, we say it returns void." 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 30 #"; vend/broken : number -> void" 0 0 24 29 1 #"\n" 0 0 17 3 48 #"; takes your money and EATS IT. NOTHING HAPPENS." 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 11 #"vend/broken" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 14 3 4 #"void" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 55 #"; vend/broken-twix : number -> string or number or void" 0 0 24 29 1 #"\n" 0 0 17 3 37 #"; works normally, except for the twix" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 16 #"vend/broken-twix" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 4 #"cond" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 6 #") " 0 0 14 3 4 #"void" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 3 #") " 0 0 19 3 7 #"\"chips\"" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 3 #") " 0 0 19 3 7 #"\"jerky\"" 0 0 24 3 1 #"]" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" [" 0 0 14 3 4 #"else" 0 0 24 3 11 #" " 0 0 14 3 7 #"payment" 0 0 24 3 3 #"]))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 62 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 7 61 4 0 0 0 9 0 24 3 1 #"(" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 14 #"" 0 0 24 3 1 #" " 0 0 14 3 10 #"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 17 3 37 #"; updates the value of " 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 31 #"; Outside vending machine stock" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 18 #"outside-stock/twix" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/chips" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/jerky" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 22 #"; stock-twix : -> void" 0 0 24 29 1 #"\n" 0 0 17 3 46 #"; decreases the number of twix in stock by one" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 20 #"decrement/stock-twix" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 18 #"outside-stock/twix" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 14 3 1 #"-" 0 0 24 3 1 #" " 0 0 14 3 18 #"outside-stock/twix" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 21 #"decrement/stock-chips" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/chips" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 14 3 1 #"-" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/chips" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 21 #"decrement/stock-jerky" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/jerky" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 14 3 1 #"-" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/jerky" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 39 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 7 121 4 0 0 0 19 0 24 3 1 #"(" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 2 #" " 0 0 14 3 16 #"" 0 0 24 29 1 #"\n" 0 0 24 3 2 #" " 0 0 14 3 16 #"" 0 0 24 29 1 #"\n" 0 0 24 3 2 #" " 0 0 14 3 3 #"..." 0 0 24 29 1 #"\n" 0 0 24 3 2 #" " 0 0 14 3 20 #"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 17 3 54 #"; executes a sequence of function calls, one at a time" 0 0 24 29 1 #"\n" 0 0 17 3 35 #"; returns the value of the last one" 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 49 #"; vend/outside-stock : number -> string or number" 0 0 24 29 1 #"\n" 0 0 17 3 56 #"; vends the item if one is in stock, else return payment" 0 0 24 29 1 #"\n" 0 0 17 3 59 #"; AN EXAMPLE OF SIDE EFFECTS AND INCONSISTENT RETURN VALUES" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 18 #"vend/outside-stock" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 4 #"cond" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 3 #"and" 0 0 24 3 2 #" (" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 14 3 1 #">" 0 0 24 3 1 #" " 0 0 14 3 18 #"outside-stock/twix" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 5 #")) (" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 40 #" (" 0 0 14 3 20 #"decrement-stock/twix" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 39 #" " 0 0 19 3 6 #"\"twix\"" 0 0 24 3 2 #")]" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 3 #"and" 0 0 24 3 2 #" (" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 14 3 1 #">" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/chips" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 4 #")) (" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 40 #" (" 0 0 14 3 21 #"decrement-stock/chips" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 39 #" " 0 0 19 3 7 #"\"chips\"" 0 0 24 3 2 #")]" 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 24 29 1 #"\n" 0 0 24 3 6 #" [(" 0 0 14 3 3 #"and" 0 0 24 3 2 #" (" 0 0 14 3 1 #"=" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 14 3 1 #">" 0 0 24 3 1 #" " 0 0 14 3 19 #"outside-stock/jerky" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 4 #")) (" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 40 #" (" 0 0 14 3 21 #"decrement-stock/jerky" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 39 #" " 0 0 19 3 7 #"\"jerky\"" 0 0 24 3 2 #")]" 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 17 3 65 #"; Refund payment if no matching item, or chosen item out of stock" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" [" 0 0 14 3 4 #"else" 0 0 24 3 1 #" " 0 0 14 3 7 #"payment" 0 0 24 3 3 #"]))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 70 ( #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" #";;" ) 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 38 #"; sum-list : (listof number) -> number" 0 0 24 29 1 #"\n" 0 0 17 3 26 #"; sums a list imperatively" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 8 #"sum-list" 0 0 24 3 1 #" " 0 0 14 3 3 #"lon" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 5 #"local" 0 0 24 3 3 #" [(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 10 #" " 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 9 #"remaining" 0 0 24 3 1 #" " 0 0 14 3 3 #"lon" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 10 #" " 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 4 #"loop" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 13 #" (" 0 0 14 3 2 #"if" 0 0 24 29 1 #"\n" 0 0 24 3 13 #" " 0 0 17 3 43 #"; If remaining is an empty list, return sum" 0 0 24 29 1 #"\n" 0 0 24 3 14 #" (" 0 0 14 3 6 #"empty?" 0 0 24 3 1 #" " 0 0 14 3 9 #"remaining" 0 0 24 3 2 #") " 0 0 14 3 3 #"sum" 0 0 24 29 1 #"\n" 0 0 24 3 13 #" " 0 0 24 29 1 #"\n" 0 0 24 3 13 #" " 0 0 17 3 14 #"; Otherwise..." 0 0 24 29 1 #"\n" 0 0 24 3 14 #" (" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 15 #" " 0 0 17 3 32 #"; First, update the value of sum" 0 0 24 29 1 #"\n" 0 0 24 3 16 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 2 #" (" 0 0 14 3 1 #"+" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 2 #" (" 0 0 14 3 5 #"first" 0 0 24 3 1 #" " 0 0 14 3 9 #"remaining" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 3 15 #" " 0 0 17 3 33 #"; Next, update the remaining list" 0 0 24 29 1 #"\n" 0 0 24 3 16 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 9 #"remaining" 0 0 24 3 2 #" (" 0 0 14 3 4 #"rest" 0 0 24 3 1 #" " 0 0 14 3 9 #"remaining" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 15 #" " 0 0 17 3 17 #"; Finally, repeat" 0 0 24 29 1 #"\n" 0 0 24 3 16 #" (" 0 0 14 3 4 #"loop" 0 0 24 3 5 #"))))]" 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 17 3 19 #"; Kick off the loop" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 14 3 4 #"loop" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 24 3 2 #" (" 0 0 14 3 8 #"sum-list" 0 0 24 3 2 #" (" 0 0 14 3 4 #"list" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 14 #" " 0 0 21 3 1 #"6" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 71 ( #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" #";;;" ) 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 7 73 4 0 0 0 11 0 24 3 1 #"(" 0 0 14 3 8 #"for-each" 0 0 24 3 1 #" " 0 0 14 3 4 #"proc" 0 0 24 3 1 #" " 0 0 14 3 3 #"lst" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 17 3 56 #"; like map because it applies proc to each lst item, but" 0 0 24 29 1 #"\n" 0 0 17 3 34 #"; doesn't return the resulting lst" 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 48 #"; sum-list/for-each : (listof numbers) -> number" 0 0 24 29 1 #"\n" 0 0 17 3 26 #"; sums a list imperatively" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 2 #" (" 0 0 14 3 17 #"sum-list/for-each" 0 0 24 3 1 #" " 0 0 14 3 3 #"lon" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 5 #"local" 0 0 24 3 2 #" [" 0 0 17 3 28 #"; Initialize the sum to zero" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 2 #")]" 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 15 3 5 #"begin" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 52 #"; Loop through the list, adding each item to the sum" 0 0 24 29 1 #"\n" 0 0 24 3 7 #" (" 0 0 14 3 8 #"for-each" 0 0 24 3 2 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 2 #" (" 0 0 14 3 4 #"item" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 19 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 2 #" (" 0 0 14 3 1 #"+" 0 0 24 3 1 #" " 0 0 14 3 3 #"sum" 0 0 24 3 1 #" " 0 0 14 3 4 #"item" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 3 16 #" " 0 0 14 3 3 #"lon" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 42 #"; After we're done looping, return the sum" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 14 3 3 #"sum" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 45 #"; Using for-each works the same way as before" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 24 3 2 #" (" 0 0 14 3 17 #"sum-list/for-each" 0 0 24 3 2 #" (" 0 0 14 3 4 #"list" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 15 #" (" 0 0 14 3 8 #"sum-list" 0 0 24 3 2 #" (" 0 0 14 3 4 #"list" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 1 #" " 0 0 21 3 1 #"2" 0 0 24 3 1 #" " 0 0 21 3 1 #"3" 0 0 24 3 3 #")))" 0 0