Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Maps, vectors, sets, and lists are the basic data structures provided by Clojure. As you’ve seen already, each of these has its own convenient literal notation:
'(a b :name 12.5) ;; list
['a 'b :name 12.5] ;; vector
{:name "Chas" :age 31} ;; map
#{1 2 3} ;; set
{Math/PI "~3.14"
[:composite "key"] 42
nil "nothing"} ;; another map
#{{:first-name "chas" :last-name "emerick"}
{:first-name "brian" :last-name "carper"}
{:first-name "christophe" :last-name "grand"}} ;; a set of maps
These categories of data structures and their notations are likely familiar to you for the most part; particularly with regard to notation, Ruby and Python are quite similar. However, Clojure data structures have a couple of distinctive characteristics: