TCEA State 1998 Slides


The Alternative

Our proposed alternative is the programming language Scheme.

Scheme was originally designed at MIT. Subsequent work has been done at MIT, Yale, Indiana, Rice, and other institutions; there is an active community that is dedicated to developing and maintaining Scheme. It is one of the most widely used teaching languages. Its two developers have both won major awards: Guy Lewis Steele, Jr won the ACM's Grace Murray Hopper Award in 1988, awarded to a young computer scientist who has made an outstanding technical contribution to the field; and Gerald Jay Sussman won the ACM's Karl Karlstrom Outstanding Educator Award in 1990. Both awards were Scheme-related.

Scheme uses a prefix syntax for algebra. Here are some examples of algebraic expressions and their Scheme equivalents. The key mantra to remember about Scheme's syntax is the following: ``left-paren, operator, arguments, right-paren''.
Algebra Scheme
1 + 2 (+ 1 2)
1 + 2 x 3.5 (+ 1 (* 2 3.5))
f(x) = x^2 - 3 (define (f x) (- (* x x) 3))
f(4) (f 4)
f(2+3) (f (+ 2 3))
These examples involve one keyword: define. define defines functions. In this case, f is declared to be a function of one argument, x; the body of the function is the next expression, (- (* x x) 3).

The syntax of Scheme is a little unusual, but it has numerous benefits:

We have also found that students grasp this syntax in very little time---typically two or three days.

At Rice, we have developed an implementation of Scheme called DrScheme. Here's a screen shot of what the Windows version of DrScheme looks like. DrScheme's window has two parts. The upper region is a text editor, as found in most programming environments. The lower part is called the Interactions window. Here's how it works.

The Interactions window gives the user a prompt (>). The user can then type in an expression and hit Enter. In response, DrScheme computes the value of the expression, prints it out, and prints the next prompt. In this way, users can experiment with as many expressions as they wish. Here's an example of a sequence of interactions with DrScheme:

> (+ 1 2)
3
> (+ 1 (* 2 3.5))
8
> (define (f x) (- (* x x) 3))
> (f 4)
13
> (f (+ 2 3))
22
>
(DrScheme doesn't print anything in response to the function definition; it simply commits the function to memory.)

In this respect, DrScheme is much like a calculator. However, its calculator doesn't only do arithmetic: it is an algebraic calculator. Indeed, Scheme is a complete programming language, and DrScheme can calculate with numbers, strings, lists, vectors, and a host of other types of data.

PLT / scheme@cs.rice.edu

Last modified at 22:38:38 CST on Sunday, February 08, 1998