;; Clojure 不区分类和结构体,
;; 两者本质相同:映射,或由 defrecord 创建的记录
(def rect {:size {:width 10 :height 10}
:point {:top 5 :left 5}})
(println "width is" (get-in rect [:size :width]))
(println "left is" (get-in rect [:point :left]))
;; 不带构造函数的记录:map->Size 按名称接收字段,
;; 省略的字段保持为 nil
(defrecord Size [width height])
(prn (map->Size {:width 10}))
(prn (map->Size {:width 10 :height 10}))