Common Lisp the Language, 2nd Edition

Next: Introduction Up: Common Lisp the Language Previous: Predefined Condition Types

# Appendix A.
Series

By Richard C. Waters

`PREFACE:` A series is a data structure much like a sequence, with similar kinds of operations. The difference is that in many situations, operations on series may be composed functionally and yet execute iteratively, without the need to construct intermediate series values explicitly. In this manner, series provide both the clarity of a functional programming style and the efficiency of an iterative programming style.

The remainder of this chapter consists of a description by Richard C. Waters of his work on an existing implementation of series. This is the culmination of many years of design and use of this approach, during which some 100,000 lines of application code have been written (by about half a dozen people over the course of seven years) using the series facility in nearly all iteration situations. This includes one large system (`KBEmacs`) of over 40,000 lines of code.

I have edited the chapter only very lightly to conform to the overall style of this book. Please see the Preface to this book for more information about the genesis of the series approach and its relationship to the work of X3J13.

> -Guy L. Steele Jr.

- Introduction
- Series Functions
  - Scanners
  - Mapping
  - Truncation and Other Simple Transducers
  - Conditional and Other Complex Transducers
  - Collectors
  - Alteration of Series
- Optimization
  - Basic Restrictions
  - Constraint Cycles
  - Defining New Series Functions
  - Declarations
- Primitives