Chapter 12Destructuring

One of the secrets of Clojure’s power is that it gives you basic tools—things like functions and vectors and maps—that let you do the simple things simply. But Clojure also provides facilities to compose those tools into more capable conglomerates that can take on the bigger jobs. On the code side, we have higher-order functions and vars and namespaces. On the data side, we have a set of simple data structures that you layer. If your problem requires it, there’s nothing stopping you from putting that vector inside of a map inside of a set inside of another map.

The downside of all this convenient data packaging is that peeling off the wrapping can be tedious. If you do have that vector inside of a map inside of a set, ...

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.