File: elevator.html

package info (click to toggle)
drscheme 1%3A352-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 71,608 kB
  • ctags: 55,284
  • sloc: ansic: 278,966; cpp: 63,318; sh: 32,265; lisp: 14,530; asm: 7,327; makefile: 4,846; pascal: 4,363; perl: 2,920; java: 1,632; yacc: 755; lex: 258; sed: 93; xml: 12
file content (45 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<title>Teachpack : Elevator</title>
</head>
<body bgcolor="#ffffff" text="#000000"
      link="#009900" vlink="#007700" alink="#cc0000">

<a href="index.html">Teachpacks for How to Design Programs</a>

<h1>Elevator</h1>

<hr> <h3><a name="elevator.ss">elevator.ss</a></h3> <!-- DOCNOTE="teach=elevator.ss" -->

<p>The teachpack <code>elevator.ss</code> 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:
<br>
<menu>
  <li><code><a name="run">run</a> : NextFloor -> void</code>
  <br>that is, it consumes an elevator controller and returns nothing .
</menu>

<br>
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:
<br> <code>   (define (controller x y z) 7) </code>
<br>It moves the elevator once, to the 7th floor.

<br>

<br>Second, set the teachpack to <code>elevator.ss</code> execute and
run:

<pre>
> (run controller)
>
</pre>
<br>

<br>
<br>
</body>
</html>