CSE 341: Introduction to Scheme

Lisp, like ML, is not so much a single language as a set of organizing ideas about language design, embodied in a large number of dialects. Fig. 1 depicts a family DAG with some important members of the Lisp family, along with a few important related languages. Languages inside the rounded box are Lisp dialects.

[Family DAG of Lisp, and related languages, with timeline]

Fig. 1: Family DAG of Lisp, and related languages

Notable events in LISP history:

Since 1992, researchers (mostly (transitive) students of Matthias Felleisen) have defined many useful extensions to R 5 RS, and implemented them in the PLT Scheme dialect, which forms the heart of the DrScheme programming environment we'll be using in this course. There is something of a cultural divide between the "MIT Scheme" community and the "PLT Scheme" community, which is probably one reason that there are no current plans to add the MzScheme extensions to a "R 6 RS" standard.

In this class, we'll stay (mostly) inside R 5 RS.

Scheme philosophy

Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary. Scheme demonstrates that a very small number of rules for forming expressions, with no restrictions on how they are composed, suffice to form a practical and efficient programming language that is flexible enough to support most of the major programming paradigms in use today.

-- Introduction to the R 5 RS

Like ML, Scheme is a mostly-functional language with strict evaluation. Unlike ML, Scheme is dynamically typed (a.k.a. latently typed) --- expressions do not have a (meaningful) static type. Instead, values carry a type at runtime, and ill-typed operations are only caught when they are evaluated.

Big ideas in Scheme/Lisp

Scheme syntax and semantics

Informally, Scheme's syntax and semantics can be stated in much less than a page. Its syntax is as follows:

program ::= S* S ::= atom | list atom ::= IDENTIFIER | NUMBER | SYMBOL | STRING | . list ::= ( S* )

A Scheme program is a list of s-expressions (the term is a contraction of "symbolic expression"). An s-expression is either an atom or a list. Atoms include variable names and literal values. A list is a sequence of whitespace-separated s-expressions inside round parens. (DrScheme also allows square brackets, for variety.)

The semantics are equally simple: