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

vector-of

clojure.core

  • (vector-of t)
Creates a new vector of a single primitive type t, where t is one
of :int :long :float :double :byte :short :char or :boolean. The
resulting vector complies with the interface of vectors in general,
but stores the values unboxed internally.

1 Example top

  • user=> (conj (vector-of :int) 1 2 3)
    [1 2 3]  ; <-- note, these are unboxes internally
    
    user=> (type (conj (vector-of :int) 1 2 3))
    clojure.core.Vec
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/gvec.clj:452 top

(defn vector-of 
  "Creates a new vector of a single primitive type t, where t is one
  of :int :long :float :double :byte :short :char or :boolean. The
  resulting vector complies with the interface of vectors in general,
  but stores the values unboxed internally."
  {:added "1.2"}
  [t]
  (let [am ^clojure.core.ArrayManager (ams t)]
    (Vec. am 0 5 EMPTY-NODE (.array am 0) nil)))
Vars in clojure.core/vector-of: EMPTY-NODE defn let
Used in 0 other vars

Comments top

No comments for vector-of. Log in to add a comment.