211 S '05 Assignments Set 1 Set 2 Set 3 Set 4 Set 5 Set 6 Set 7 Set 8 Set 9 Set 10 Set 11 Set 12 Set 13 Set 14

### Problem Set 4

Due date: 1/31 @ 4:30 pm

The goal is to understand data definitions for unions of data and self-referential data definitions.

HtDP Problems:

7.2.1, 7.2.2, 9.5.4, 9.5.6, 10.1.7

A bus service in Summit County, CO uses three kinds of buses to connect A-Basin with Beaver Creek:

1. `local`, which stops at all four mountains (Keystone, Breckenridge, Copper, and Vail) en route;
2. `regional`, which stops at Keystone and Breckenridge only;
3. `express`, which stops only at the destination.
All buses run every day. A schedule for each kind of bus consists of (1) the time when the bus leaves A-Basin, (2) when it arrives at Beaver Creek, and (3) when it arrives at the intermediate stops, if any.

Your company supplies a software application for assisting the help desk clerks of this bus company. Develop a data definition for the bus schedules.

Develop a function that when given a bus schedule and a time, determines whether the bus arrives before the given time at its destination.

Develop a function that when given a list of Posns, creates a list of that many numbers. The n-th number in the resulting list is the distance from the n-th Posn to the origin.

Develop the function `create-movie`, which when given a list of (positive) numbers, creates a list of that many solid green squares. The side-length of the n-th solid square is 10 times the n-th number in the given list. When you have developed the function, including tests, use the function `run-movie` to display the result of your function for some samples:

``````
(big-bang 200 200 0 0)
(run-movie
(create-movie
(cons 10 ...)))
```
```

Optional:

Please explain any problems you had completing this assignment in no more than 30 words.

 last updated on Wednesday, April 13th, 2005 3:57:37pm generated with PLT Scheme -- (Source)