CS1321 Fall AY2002
Homework 10
Due via Webwork before 6 a.m. Tuesday, Oct. 2, 2001
Note: Webwork will stop accepting this homework at that time - Turn it
in well BEFORE then.
No late homework is accepted.
Instructions:
TURN IN THIS ASSIGNMENT USING WEBWORK!!!
Do this homework using DrScheme.
At the top of your file, include the student info portion of the HW
Skeleton (Name, GT Number, HW, Course, Instructor, Lecture Time).
Clarifications added to the original version are in red.
-
Problem 12.2.1.
- You can assume that dates and names are unique. (You
do not need to worry about sorting on a secondary
key.)
- The book has a typographical error on
page 174. The information in the rectangular text box is
not quite right. Luckily the online version is correct.
Click the link for the problem. What you see in the
brown colored rectangle,
"A mail-message is a
structure:
(make-mail name n s)
where name is a string, n
in a number, and s is a string.",
is the correct version!
(The hardcopy book mistakenly says "make-structure"
instead of "make-mail".)
- To clarify what is meant by the date field, the date field is
a number. You can imagine that
(make-mail "Randy" 2001 "hi honey")
constructs a good mail-message.
(make-mail "Michael" 2000 "Call me!")
is also a good mail-message.
- In the case of sorting by date, you are to produce a
list that is ascending based on date. All dates are
unique. (See #1 above.)
(Yes, imagine you get 1 email per year based on
the example I have given.)
So for the above two mail-message structures, the
resultant list after sorting would be
(cons (make-mail "Michael" 2000 "Call me!")
(cons (make-mail "Randy" 2001 "hi honey")
empty))
-
Problem 14.1.3.
For each of the problems above, follow the HW skeleton and proper
Design Recipe. Part of the assignment is to determine whether the
template portion of the recipe is required. Be sure to use an
adequate number of test cases and examples.
Hint, be sure to think seriously about your test cases. One obvious
test you should always include unless your problem actually says that
it cannot occur, is testing by passing the empty list as a parameter
to your list processing function. Test using many different lists
structured in ways so that all categories of lists are indeed tested.