The Grinnell Scheme Web: Commands and
expressions

So far, all the commands that you've shown are calls to procedures. Is that basically what a command is Scheme, or are there other kinds of commands?

A Scheme command always directs Scheme to evaluate an expression. However, there are many kinds of expressions in Scheme -- procedure calls are only one of them. You've already seen numerals, which are another kind of expression. You can command Scheme to evaluate a numeral if you like, but in the case of integer numerals the results are pretty boring:

> 23
23
> -7462
-7462
> -0
0
What exactly is an expression?

An expression is a syntactic construction that can be evaluated to obtain a value. Every expression in Scheme is of one of the following kinds:

  1. Variable references
  2. Literal expressions (including numerals)
  3. Procedure calls (sometimes called applications or combinations)
  4. Lambda-expressions
  5. If-expressions
  6. Assignment expressions
  7. Cond-expressions
  8. Case-expressions
  9. And-expressions
  10. Or-expressions
  11. Let-expressions
  12. Let*-expressions
  13. Letrec-expressions
  14. Compound expressions
  15. Do-expressions
  16. Named-let-expressions
  17. Quasiquotations
Don't be intimidated by this list. We'll encounter these constructions gradually, one by one.

The first six kinds are collectively called primitive expression types; the rest are derived expression types. Derived expressions are theoretically superfluous, since they can be translated into equivalent expressions of the primitive types; in fact, many implementations of Scheme perform such translations before evaluating derived expressions. In most cases, however, derived expressions are easier for human readers to interpret and understand than their primitive equivalents.


Next topic
Previous topic
Table of contents


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/scheme-web/commands.html


created June 25, 1995
last revised December 26, 1995

Copyright 1995 by John David Stone (stone@math.grin.edu)