Arrays and collections / Dictionaries

; Empty map — a literal, or built by a function
(def m1 {})
(def m2 (hash-map))

; A literal with data; commas are whitespace, they only help the eye
(def m3 {1 "one"2 "two"})
(def m4 (hash-map :one 1 :two 2))

; Built out of two sequences, key by key
(def m5 (zipmap [1 2 3] ["one" "two" "three"]))

; A map is persistent: assoc gives back a NEW map, m4 stays as it was
(def m6 (assoc m4 :three 3))

(println "m1 is" (pr-str m1) "and m2 is" (pr-str m2))
(println "m3 is" (pr-str m3))
(println "m4 is" (pr-str m4))
(println "m5 is" (pr-str m5))
(println "m6 is" (pr-str m6))