Problem Set 3, CS 257

Due noon Thurs Sep 18, 1997
  1. Do the following problems from the book:

    5.1
    5.2
    5.9
    5.19

    6.7

    7.1
    7.2
    7.4
    7.8
    7.10
    7.11
    7.13

    8.1
    8.2
    8.3
    8.4
    8.7
    8.10
    8.12
    8.15

    12.2
    12.5
    12.8
    12.11
    12.13 (extra credit)

  2. Define procedures my-keep, my-accumulate, my-every.

    They should do the exact same thing the predifined procedures without the my- prefix do, and they should be defined using recursion, and without calling any higher order procedures. (They only have to work when the second argument is a sentence: don't go to any trouble to make them work when the second argument is a word.)

    For extra credit define my-repeated as well.

  3. Use recursion to define cool-picture that uses the turtle to draw something cool. Be creative. And be sure to document it.

  4. Define a function circle-sentence-and-add which is just like circle-sentence from PS2, except that its argument must be a sentence of numbers, and it writes a running total around the perimeter of the circle. For instance,
    (circle-sentence-and-add '(1 1 1 1 100 50 1 2 3))
    
    puts up a picture like this:

    Hint: use a helper function of two arguments that does all the work.
Turn in this problem set by running the program ~barak/bin/submit file1.scm file2.scm ...

All the files should be legal scheme code, with comments indicating which fragment of code corresponds to which problem, and comments with any answers to questions that require answers to be in English rather than Scheme.

You must submit all your files at once! You are allowed to make corrections, because your last submit command overwrites any data previously submitted.
Barak Pearlmutter <bap@cs.unm.edu>