1.3.0 permalink Arrow_down_16x16

array-map

clojure.core

  • (array-map)
  • (array-map & keyvals)
Constructs an array-map.

3 Examples top

  • user=> (array-map [1 2] [3 4 5])
    {[1 2] [3 4 5]}
  • user=> (array-map :a 10)
    {:a 10}
    
    user=> (array-map :a 10 :b 20)
    {:a 10 :b 20}
    
    user=> (apply array-map [:a 10 :b 20 :c 30])
    {:a 10 :b 20 :c 30}
    
    user=> (apply assoc {} [:a 10 :b 20 :c 30]) ;same result using assoc
    {:a 10 :b 20 :c 30}
    
  • user=> (keys (assoc (array-map :foo 10 :bar 20) :baz 30))
    (:baz :foo :bar)
    ; baz is first; :foo and :bar follow the order given to array-map
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:3888 top

(defn array-map
  "Constructs an array-map."
  {:added "1.0"
   :static true}
  ([] (. clojure.lang.PersistentArrayMap EMPTY))
  ([& keyvals] (clojure.lang.PersistentArrayMap/createWithCheck (to-array keyvals))))
Vars in clojure.core/array-map:
Used in 0 other vars

Comments top

No comments for array-map. Log in to add a comment.