Wrapping Up

In this chapter we looked at the Swiss Army knife of Clojure data structures, the map. We saw that Clojure maps let you associate arbitrary keys with equally arbitrary values. Along the way we discovered that Clojure keywords make great map keys. We also looked at several ways you can look up a value in your map, and at how you can create new maps with additional—or fewer—keys. We also had a look at the map’s close cousin, the set. We saw how you can test set membership in much the same way that you look up values in a map. Then we looked at the real-world use of maps, sets, and keywords in the clojure.java.jdbc library. We also saw why you want to keep in mind that while keywords have a lot in common with strings, they are indeed ...

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