CS 6520 HW 2

Implement the following in either Scheme or psuedo-Scheme on paper. In other words, don't worry too much about syntax, and don't bother executing your code on a computer, but try to implement the functions following the design recipe described in lecture. If you get stuck, ask for help.

  1. A Pittsburgh road is either a dead-end or a branch to two other Pittsburgh roads. Each branch has an sign suggesting which of the two directions to take.

    Create a data definition for Pittsburgh roads and a generic template.

  2. Implement the Pittsburgh-road function count-dead-ends.

  3. Implement the Pittsburgh-road function distance-to-suggested-dead-end, which returns the number of branches leading to a dead end, assuming that the driver takes the direction suggested by every sign.


Last update: Friday, February 6th, 2004
mflatt@cs.utah.edu