Инициализация типов / Классы

;; defrecord defines a type and its positional constructor ->Phone
(defrecord Phone [model])
(defrecord Employee [first-name last-name personal-phone])

(def nokia-phone (->Phone "Nokia 6610"))
(def kim (->Employee "Victorya" "Kim" (->Phone "iPhone 5")))

;; for a plain map an ordinary function plays the constructor
(defn make-phone [model] {:model model})

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