link="#009900" vlink="#007700" alink="#cc0000"> Teachpacks for How to Design Programs


The teachpack implements an elevator simulator. It displays an eight-floor elevator and accepts mouse clicks from the user, which are translated into service demands for the elevator. The teachpack provides a single operation:

  • run : NextFloor -> void
    that is, it consumes an elevator controller and returns nothing .

  • Sample session: First define a function that consumes the current state of the elevator (three arguments) and returns a number between 1 and 8. Here is a non-sensical definition:
    (define (controller x y z) 7)
    It moves the elevator once, to the 7th floor.

    Second, set the teachpack to execute and run:
    > (run controller)