Copyright © 2003-2005, Peter Seibel

12. They Called It LISP for a Reason: List Processing

Lists play an important role in Lisp—for reasons both historical and practical. Historically, lists were Lisp’s original composite data type, though it has been decades since they were its only such data type. These days, a Common Lisp programmer is as likely to use a vector, a hash table, or a user-defined class or structure as to use a list.

Practically speaking, lists remain in the language because they’re an excellent solution to certain problems. One such problem—how to represent code as data in order to support code-transforming and code-generating macros—is particular to Lisp, which may explain why other languages don’t feel the lack of Lisp-style lists. More generally, lists are an excellent data structure for representing any kind of heterogeneous and/or hierarchical data. They’re also quite lightweight and support a functional style of programming that’s another important part of Lisp’s heritage.

Thus, you need to understand lists on their own terms; as you gain a better understanding of how lists work, you’ll be in a better position to appreciate when you should and shouldn’t use them.