CSC 160 HW7
Assigned 8 April, due 19 April
For all the programming assignments, be sure to follow the design recipe.
Write
your function contract, examples, and function definition in the Definitions
Window, save it to a file, and send me this file. Also, test
your program by typing each of your examples into the Interactions Window,
save it to a file, and send me this file. Be sure to choose meaningful
names for functions and parameters, and watch for opportunities to use
functions you've already written.
Also turn in a log of how many errors of different kinds you
encountered in the assignment, with brief comments describing each one
("mismatched parentheses" is self-explanatory, but more complex errors
might need more description).
This assignment is to be done in pairs, as before.
- Do (but don't turn in) exercises
9.1.1,
9.1.2,
9.1.3,
9.3.3,
and
9.5.1.
- Develop a function count-dolls that takes
in a list of symbols, and returns how many times the symbol
'doll occurs in the list.
Then develop a function count that takes
in a symbol and a list of symbols, and returns how many times that
symbol occurs in the list.
- Develop a function any-true? that takes
in a list of booleans and decides whether any of them (i.e. at
least one) are true. What built-in Scheme function does this resemble?
- Do exercises
9.5.3,
9.5.5,
9.5.6,
9.5.7,
and
9.5.8.
- Develop a function contains-all? that
takes in two lists of symbols, and tells whether the first list
contains all the elements of the second list.
(Hint: use
contains? as a helper!)
- Do exercises
10.1.5,
10.1.6,
and
10.1.7.
- Develop a function in-both that
takes in two lists of symbols, and produces a list of the
symbols that are in both.
(Hint: use
contains? as a helper!)
Last modified:
Stephen Bloch / sbloch@adelphi.edu