You're viewing version 1.2.0 of defstruct. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

defstruct

clojure.core

  • (defstruct name & keys)
Same as (def name (create-struct keys...))

1 Example top

  • user=> (defstruct person :name :age :height)
    #'user/person
    
    user=> (struct person "george" 22 115)
    {:name "george", :age 22, :height 115}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3115 top

(defmacro defstruct
  "Same as (def name (create-struct keys...))"
  {:added "1.0"}
  [name & keys]
  `(def ~name (create-struct ~@keys)))
Vars in clojure.core/defstruct: defmacro keys name concat create-struct list seq

Comments top

No comments for defstruct. Log in to add a comment.