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.
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.
Implement the Pittsburgh-road function count-dead-ends.
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, firstname.lastname@example.org|