Cover by Conrad Barski M.D.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Chapter 9. Advanced Datatypes and Generic Programming

As you’ve seen so far, a lot can be accomplished in Lisp by using cons cells, symbols, strings, and numeric datatypes. As a very mature language, Common Lisp contains many more datatypes that move well beyond these basics. In this chapter, we will discuss the most useful of these advanced datatypes, including arrays, hash tables, and structures.

Arrays

The Common Lisp array is very similar to a list. The main advantage of using arrays is that they require only a constant amount of time to access a value at any specific location. We’ll be discussing what this means shortly.

Working with Arrays

To create a new array, use the make-array command, specifying the array’s size:

> (make-array 3) #(NIL NIL ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required