Chapter 15Spec

One thing you may have noticed about Clojure programs—and Clojure programmers—is that they rarely talk about data types. Oh, sure, we have strings and symbols and maps and vectors along with various record types, but what’s important in Clojure is less the data type than the data shape. Thus we tend not to think of our data as an AggregateBookCollection, which contains instances of BookEntities, each one having instances of Author and Title. Instead we look at it as a vector of maps, where each map has :title, :author, and :copies keys.

Since Clojure is more concerned with the shape of data than its type, Clojure programmers spend a fair amount of time verifying that the value they’ve just been handed has the right shape.

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.