a02 - CS 135 Winter 2012 Brad Lushman Assignment: 2 Due:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Brad Lushman Assignment: 2 Due: Wednesday, January 18, 9:15am Language level: Beginning Student Files to submit: cond.rkt , sequence.rkt , grades.rkt , intervals.rkt Warmup exercises: HtDP 4.1.1, 4.1.2, 4.3.1, 4.3.2 Practise 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. 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 equivalent expressions . These are new expressions that always produce the same answer as the original (given the same inputs, of course). For example, the following are all equivalent: ( cond [( > x 0 ) ’ One ] [( < = x 0 ) ’ Two ]) ( cond [( < = x 0 ) ’ Two ] [( > x 0 ) ’ One ]) ( cond [( > x 0 ) ’ One ] [ else Two ]) (There is one more really obvious equivalent expression; think about what it might be.) So far all of the cond examples we’ve seen in class have followed the pattern ( cond [ question1 answer1 ] [ question2 answer2 ] . . . [ questionk answerk ]) where questionk might be else . The questions and answers do not need to be simple expressions like we’ve seen in class. In particular, either the question or the answer (or both!) can themselves be cond expressions. In this problem, you will practice manipulating these so-called “nested cond ” expressions. CS 135 — Winter 2012
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2012 for the course CS 135 taught by Professor Vasiga during the Winter '07 term at Waterloo.

Page1 / 5

a02 - CS 135 Winter 2012 Brad Lushman Assignment: 2 Due:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online