Skip to Content
Clojure Applied
book

Clojure Applied

by Ben Vandgrift, Alex Miller
August 2015
Intermediate to advanced
220 pages
5h 53m
English
Pragmatic Bookshelf
Content preview from Clojure Applied

Accessing Collections

The purpose of our collections is to store our data, but they’re only useful if we can get the data back out of the collection. Let’s first consider the collections that support indexed lookup by a key.

Indexed Access

Maps and vectors are the two indexed collections provided in Clojure. Vectors use 0-based indexes and are treated as associative collections from index to element. The records that we saw while modeling our domain also implement the map interfaces and can be treated as indexed collections.

Indexed collections support lookup by three methods. The first is by invoking the get function with the collection and a key. The second is by invoking the collection itself with a key. The third is by invoking a keyword ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clojure Programming

Clojure Programming

Chas Emerick, Brian Carper, Christophe Grand
Living Clojure

Living Clojure

Carin Meier
Clojure Cookbook

Clojure Cookbook

Ryan Neufeld, Luke VanderHart

Publisher Resources

ISBN: 9781680501476Errata Page