Type initialization / Classes

;; Clojure has no classes; a map holds the named fields
(def nokia-phone {:model "Nokia 6610"})

(def kim {:first-name "Victorya"
          :last-name "Kim"
          :personal-phone {:model "iPhone 5"}})

(println "nokia-phone model is" (:model nokia-phone))
(println "kim's phone is" (get-in kim [:personal-phone :model]))

;; defrecord names a type; map->Phone fills it field by field,
;; and a field left out is simply nil
(defrecord Phone [model year])
(prn (map->Phone {:model "iPhone 5"}))