Scheme was introduced in 1975 by Gerald J. Sussman and Guy L. Steele Jr. [20,21], and was the first dialect of Lisp to fully support lexical scoping, first-class procedures, and continuations. In its earliest form it was a very small language intended primarily for research and teaching, supporting only a handful of predefined syntactic forms and procedures. Scheme is now a complete general-purpose programming language, though it still derives its power from a small set of key concepts. Early implementations of the language were interpreter-based and slow, but some current Scheme implementations boast sophisticated compilers that generate code on par with code generated by the best optimizing compilers for lower-level languages such as C and Fortran.

This book is intended to provide an introduction to the Scheme programming language but not an introduction to programming in general. The reader is expected to have had some experience programming and to be familiar with terms commonly associated with computers and programming languages. The author recommends that readers unfamiliar with Scheme or Lisp also read The Little Schemer [8] to become familiar with the concepts of list processing and recursion. Readers new to programming should begin with an introductory text on programming.

Scheme has been standardized both formally and informally. The "IEEE Standard for the Scheme Programming Language" [13], describes the formal ANSI/IEEE Standard for Scheme. A related series of reports, the "Revised Reports on the Algorithmic Language Scheme," document an evolving informal standard that most implementations support. The current report in this series is the "Revised5 Report on the Algorithmic Language Scheme" [14].

This book covers everything in both standards. Features included in the Revised5 Report but not in the ANSI/IEEE standard are identified as such when they are described. This book also documents the portable "syntax-case" syntactic abstraction system that has been adopted by many Scheme implementations. Features specific to particular implementations are not included. In particular, features specific to the author's Chez Scheme and Petite Chez Scheme are described separately in the Chez Scheme User's Guide [5].

A large number of small- to medium-sized examples are spread throughout the text, and one entire chapter is dedicated to the presentation of a set of longer examples. Many of the examples show how a standard Scheme syntactic form or procedure might be implemented; others implement useful extensions. Nearly all Scheme systems are interactive, and all of the examples can be entered directly from the keyboard into an interactive Scheme session.

This book is organized into nine chapters, plus appendices. Chapter 1 describes the properties and features of Scheme that make it a useful and enjoyable language to use. Chapter 1 also describes Scheme's notational conventions and the typographical conventions employed in this book.

Chapter 2 is an introduction to Scheme programming for the novice Scheme programmer that leads the reader through a series of examples, beginning with simple Scheme expressions and working toward progressively more difficult ones. Each section of Chapter 2 introduces a small set of related features, and the end of each section contains a set of exercises for further practice. The reader will learn the most from Chapter 2 by sitting at the keyboard and typing in the examples and trying the exercises.

Chapter 3 continues the introduction but covers more advanced features and concepts. Even readers with prior Scheme experience may wish to work through the examples and exercises found there.

Chapters 4 through 8 make up the reference portion of the text. They present each of Scheme's primitive procedures and syntactic forms in turn, grouping them into short sections of related procedures and forms. Chapter 4 describes operations for creating procedures and variable bindings; Chapter 5, program control operations; Chapter 6, operations on the various object types (including lists, numbers, and strings); Chapter 7, input and output operations; and Chapter 8, syntactic extension.

Chapter 9 contains a collection of complete example programs or packages, each with a short overview, some examples of its use, the implementation with brief explanation, and a set of exercises for further work. Each of these programs demonstrates a particular set of features, and together they illustrate an appropriate style for programming in Scheme.

Following Chapter 9 are a bibliography, answers to selected exercises, a detailed description of the formal syntax of Scheme programs and data, a concise summary of Scheme syntactic forms and procedures, and the index. The summary of forms and procedures is a useful first stop for programmers unsure of the structure of a syntactic form or the arguments expected by a primitive procedure. The page numbers appearing in the summary of forms and procedures and the italicized page numbers appearing in the index indicate the locations in the text where forms and procedures are defined.

Because the reference portion describes a number of aspects of the language not covered by the introductory chapters along with a number of interesting short examples, most readers will find it profitable to read through most of the material to become familiar with each feature and how it relates to other features. Chapter 6 is lengthy, however, and may be skimmed and later referenced as needed.

An online version of this book is available at The summary of forms and index in the online edition include page numbers for the printed version and are thus useful as searchable indices.

About the illustrations: The cover illustration and the illustrations at the front of each chapter are monohedral tilings created by artist Jean-Pierre Hébert. In a monohedral tiling, all tiles are congruent: they have the same size and shape but may be flipped. The base tile is called the prototile of the tiling. Many familiar and trivial monohedral tilings are known, but no known algorithm exists to decide whether a tile is the prototile of a monohedral tiling.

Some of the most interesting tilings are spiral shaped, and the spirals may have from one to many arms. They come from a number of known prototiles, the first one having been discovered by Voderberg in 1936. Illustrations of the curious Voderberg tile (on the cover and at the front of Chapter 3) show how two tiles can surround one or even two similar ones and how they can be assembled to generate straight lines, arcs or circles, random paths, or regular paths.

For each of the illustrations, a Scheme program was used to define tiles and placement rules for these tiles, resulting in diverse monohedral spiral and non-spiral tilings of the plane. Monohedral tilings were output directly as plane geometries in Postscript to produce the illustrations appearing at the front of Chapters 1, 4, and 7. For the remaining illustrations, the tilings were warped in various ways and augmented with the help of Geomview (Geometry Center, Minneapolis), which allows for spatial manipulations, insertions, and adjustments in color, perspective, light, and material.

Acknowledgements: Many individuals contributed in one way or another to the preparation of one or more editions of this book, including Bruce Smith, Eugene Kohlbecker, Matthias Felleisen, Dan Friedman, Bruce Duba, Phil Dybvig, Guy Steele, Bob Hieb, Chris Haynes, Dave Plaisted, Joan Curry, Frank Silbermann, Pavel Curtis, John Wait, Carl Bruggeman, Sam Daniel, Oscar Waddell, Mike Ashley, John LaLonde, John Zuckerman, and John Simmons. Many others have offered minor corrections and suggestions. Oscar Waddell helped create the typesetting system used to format the printed and online versions of this book. Fred is no longer with us, but his faithful companionship is not forgotten. Finally and most importantly, my wife, Susan Dybvig, suggested that I write this book in the first place and lent her expertise and assistance to the production and publication of all three editions.

R. Kent Dybvig
Bloomington, Indiana

R. Kent Dybvig / The Scheme Programming Language, Third Edition
Copyright © 2003 The MIT Press. Electronically reproduced by permission.
Illustrations © 2003 Jean-Pierre Hébert
ISBN 0-262-54148-3 / LOC QA76.73.S34D93
to order this book / about this book