带参数

类 / 构造函数

(defrecord Man [name country])

;; ->Man 按声明的顺序接收字段
(def man (->Man "Alex" "Russia"))
;; (:name man) is "Alex"

;; map->Man 按名称接收,顺序任意
(def other (map->Man {:country "Brazil" :name "Max"}))

(println "name is" (:name man) "country is" (:country man))
(println "name is" (:name other) "country is" (:country other))