Hash Tables

In the same way that arrays are sort of like lists, hash tables are sort of like alists, except that they also allow you to access arbitrary elements more quickly.

In fact, hash tables are so efficient that they can, at times, seem like magic. Think of the Babel fish in the Hitchhiker’s Guide to the Galaxy trilogy—something so impossibly useful that it really has no business existing in the first place. That’s why almost all modern languages now offer the hash table datatype.

image with no caption

Working with Hash Tables

Create a new hash table with the make-hash-table command:

> (make-hash-table)

Like alists, hash tables store items using ...

Get Land of Lisp now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.