elevator-lib.ss

The library elevator-lib.ss 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 library provides a single operation:

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

  • Sample session: First define a program 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 library to elevator-lib.ss execute and run:
    > (run controller)
    > 
    


    For more details, see exercise x.y.