Due date: 10/13 @ 6:00 pm
This problem set is about dealing with lists and other
kinds of self-referential data definitions.
You will also learn to deal with list abbreviations so that it becomes
easier to enter data in DrScheme. You may use them if you wish already;
if so, it's probably best if you do 13.0.8 first.
10.2.4, 12.2.1, 13.0.8 (page 187)
Additional Problem 1:
Your boss asked you to write a part of a mass mailing program. He has
already specified the central class of data that everyone on his team
must use so that the pieces can work together:
(define-struct target (title first last age income))
;; A Target is a structure:
;; (make-target Title String String Number Number)
;; A Title is one of:
;; --- false
;; --- String
Your task is to develop a function that when given a list of targets
produces a list of letters opening. In general, a letter opening starts
with "Dear" followed by personalizing material and ending in ":":
Dear Prof. Dr. Clements:
Target contains a proper title string, the letter
opening uses the last name only, like the above example.
false for the title, a
letter opening uses the name only:
A letter opening never uses both the first and the last name.
Additional Problem 2:
Develop the function
truncate, which truncates all lines in
a mail message that are more than 80 characters wide. A mail message is a
list of lines; each line is a string.
Hint: The function
substring consumes a string and two
numbers and uses these numbers to extract a portion of the
string. Experiment to find out what it does and use it to solve the
Additional Problem 3:
Develop a function that extracts the content from a Russian Easter egg.
(define-struct reg (deep))
;; A Russian Easter egg (REG) is one of:
Practice Problem [no credit]:
Develop a function that when given a list of colors,
create a bull's eye from these colors. Each ring has
a width of 10 pixels; the interior of the bull's eye
is always a black disk with radius 10. Hint:
how many items are on a list.
> (bulls-eye (cons 'green (cons 'red empty)))