CSci 1301: Problem Set 5

Due: Monday, November 9th at 11:59pm by e-mail

You are required to write signatures (contracts) and descriptions for all functions, and also descriptions of all your structures. Additionally, functions, except the world problems, must be tested using check-expect. Write your tests before you write a function (but feel free to add more after it's been writen).

The quality of your tests will be graded. Make sure to have enough test cases to demonstrate that the function is correct. I may take points off for a lack of testing (in addition to those taken off for incorrect behavior) if your function doesn't work on particular expected data and there is no test for it. It's much better to leave a test that fails (perhaps in comments) that shows that the function doesn't work on given data and you don't know how to fix it.

Writing helper recursive functions (15 points total)

Exercises 187, 188, 190 in section 12.3 "Design" in this case means to write the function (with test cases, description, etc.)
This is an example of an email structure for exercise 187:


(make-email "Mary Smith" 3455557 "Hi there!")

Note that strings are represented as lists of characters in exercise 190. All prefixes of a string (list "c" "a" "t") is a list (list (list "c" "a" "t") (list "c" "a") (list "c") empty). The order doesn't matter, just be careful to use the same order in your check-expect.
All suffixes of this string are (list (list "c" "a" "t") (list "a" "t") (list "t") empty)

Extended exercise (15 points total)

Exercises 198, 199, 200 in Section 13.2. Note that you may need to read some of the material in 13.1 (in particular, it has an example of a result).
1String is just a string of only one letter, such as "a".


CSci 1301 course web site.