Changes for clojure.core/struct-map

zkim on Sun, 26 Sep 2010
;; create a new struct type
(defstruct s :1 :2)
#'user/s

user=> (type s)
clojure.lang.PersistentStructMap$Def

;; create an instance of this new struct type
(def s1 (struct s "one" "two"))
#'user/s1

user=> (println s1)
{:1 "one", :2 "two"}

user=> (type s1)
clojure.lang.PersistentStructMap

;; create a new struct instance that is based on the previous struct type
;; with the option of supplying a new key/value pairs
(def s2 (struct-map s :3 "three"))
#'user/s2

user=> (println s2)
{:1 nil, :2 nil, :3 "three"}

user=> (type s2)
clojure.lang.PersistentStructMap
james on Wed, 01 Sep 2010
<tt>;;</tt> comment

<tt>;></tt> output

;; create a new struct type
(defstruct s :1 :2) ;> #'user/s
(type s)            ;> clojure.lang.PersistentStructMap$Def

;; create an instance of this new struct type
(def s1 (struct s "one" "two"))    ;> {:1 "one", :2 "two"}
(type s1)                          ;> clojure.lang.PersistentStructMap

;; create a new struct instance that is based on the previous struct type
;; with the option of supplying a new key/value pairs
(def s2 (struct-map s :3 "three")) ;> {:1 nil, :2 nil, :3 "three"}
(type s2)                          ;> clojure.lang.PersistentStructMap