defstruct is a Clojure macro that binds a named struct definition to a var. The definition guarantees a fixed set of keys while retaining map-like behavior. section 11.1.4
Define and populate a waypoint struct
(defstruct waypoint :type :lat :lon :id) (struct-map waypoint :type "VHF" :lat "0.0" :lon "0.0" :id "ABI") ;; {:type "VHF", :lat "0.0", :lon "0.0", :id "ABI"} (defn to-waypoints [coords] (map #(apply struct-map waypoint (mapcat identity %)) coords)) Missing defined keys appear with nil values, while additional keys can remain in the resulting map.
