COM1340 - Winter 2003
Assignment 2
Due: January 29, 2003

Set DrScheme to use the PLT | Graphical language level.

For exercises 1, 2, and 4, provide a procedure definition and appropriate test data. In each case, at least four (4) test cases other than the examples provided here must be given. Pick your test cases so that the data examines as many paths through the code as possible. Assume that the input data is valid; do not try to trap invalid data.

Print out your work. On your printout, legibly write your name and ``COM1340 -- Assignment 2.''

1.) Define a Scheme procedure remove-green-animals that takes a list of symbols and returns the input list with the green animals removed. Green animals are those in the list

  '(frog toad alligator cricket)

Example:

  (remove-green-animals 
    '(lettuce tomato frog sesame-seed-bun)) => 
  (lettuce tomato sesame-seed-bun)

You may want to use the procedure member, which is described in PLT Help Desk.

2.) Define a Scheme procedure symbols->tds that takes a list of symbols and returns a list of HTML TD elements, each containing a string formed from a symbol in the input list. To illustrate:

  (symbols->tds 
    '(squishy-toad crunchy-frog crackly-porcupine)) => 
  ((TD "squishy-toad") (TD "crunchy-frog") (TD "crackly-porcupine"))

You'll need to use the Scheme primitive symbol->string, which takes a symbol and returns a string.

Last modified: Thurs, Jan 16, 2003, 12:16 pm US/Eastern
HTML conversion by TeX2page 4p4k3