Choosing the Right Collection

Clojure has a small number of provided collections that are used in combination for virtually every application need. We expect that you’re already familiar with the basics of the four primary Clojure collections: lists, vectors, sets, and maps.

When choosing the right collection to use, we’re guided by the characteristics of the data at hand and the operations we expect to call on the collection. Clojure collection functions often specify performance constraints that must be met by the implementer.

If we need an association from a key to a value, maps are the obvious choice. In our domain model we considered the use of maps as an entity holder— as an association between entity field and value. We also saw maps ...

Get Clojure Applied 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.