This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 135 Fall 2011 Becker, Goldberg, Kaplan, Tompkins, Vasiga Assignment: 2 Due: Tuesday, September 27, 2011 9:00 pm Language level: Beginning Student Files to submit: cond.rkt , grades.rkt , donate-cond.rkt , donate-bool.rkt Warmup exercises: HtDP 4.1.1, 4.1.2, 4.3.1, 4.3.2 Practice exercises: HtDP 4.4.1, 4.4.3, 5.1.4 Policies from Assignment 1 carry forward. For example, your solutions must be entirely your own work, and your solutions will be marked for both correctness and good style. Good style includes qualities such as descriptive names, clear and consistent indentation, appropriate use of helper functions, and documentation (design recipe). For this and all subsequent assignments you are expected to use the design recipe as discussed in class (except for question 1 on this assignment). You must use check-expect for both examples and tests. It is very important that the function names and parameters match ours. You must use the public tests to be sure. The names of the functions will be given exactly. The names of the parameters are up to you, but should be meaningful. The order and meaning of the parameters are carefully specified in each problem. Here are the assignment questions you need to submit. 1. A cond expression can always be rewritten to produce an equivalent expression . That is, the new expression always produces the same answer as the old expression (given the same inputs, of course). For example, the following are all equivalent: ( cond [( > x ) Up ] [( < = x ) Down ]) ( cond [( < = x ) Down ] [( > x ) Up ]) ( cond [( > x ) Up ] [ else Down ]) (There is one more really obvious equivalent expression; think about what it might be.) So far all of the cond examples weve seen in class have followed the pattern ( cond [ question1 answer1 ] [ question2 answer2 ] ... [ questionk answerk ]) where questionk might be else ....
View Full Document
This note was uploaded on 10/27/2011 for the course CS 135 taught by Professor Vasiga during the Fall '07 term at Waterloo.
- Fall '07