7. Sequences and Iteration

Lists (see Chapter 2) and vectors (see Chapter 5) have in common that you can traverse them sequentially. That’s why they are subsumed under the type SEQUENCE in COMMON LISP. There are a lot of functions in the standard that work on sequences, which is to say that they accept lists as well as vectors as arguments. (And also strings, see Chapter 3, because those are vectors, too.) We’ll discuss most of them in this chapter. (And see also Recipe 3-7.)

Sequences are also intimately related to iteration, which is the other major topic of this chapter. We are not going to discuss the basics of iteration because we’re assuming that you already have some experience with DO, DOTIMES, LOOP, and friends.1 But maybe we can present ...

Get Common Lisp Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.