6. Hash Tables, Maps, and Sets

As stated in the introduction to Chapter 5, lists aren’t the only data structure in COMMON LISP. In addition to arrays, the standard also offers hash tables which are data structures that map keys to values by means of a hash function. Ideally, the cost of hash table lookups, as well as insertions or deletions of new entries, is independent of the number of elements stored in the table (although, see Recipe 6-5), which makes them a powerful alternative to other ways of organizing data.

Practical Common Lisp provides a brief introduction to hash tables on pages 138 to 140, but if you’ve never used hash tables before, reading through Recipes 6-1 to 6-6 (in that order) might serve as an introduction as well.1

Hash ...

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.