make-array

function/macrosince v0.0-1211 clojure.core/make-arrayEdit
(make-array size)
(make-array type size)
(make-array type size & more-sizes)

Details:

Creates an empty JavaScript array of size size.


See Also:


Source docstring:
Construct a JavaScript array of the specified dimensions. Accepts ignored
type argument for compatibility with Clojure. Note that there is no efficient
way to allocate multi-dimensional arrays in JavaScript; as such, this function
will run in polynomial time when called with 3 or more arguments.
Function code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn ^array make-array
  ([size]
     (js/Array. size))
  ([type size]
     (make-array size))
  ([type size & more-sizes]
    (let [dims more-sizes
          dimarray (make-array size)]
      (dotimes [i (alength dimarray)]
        (aset dimarray i (apply make-array nil dims)))
      dimarray)))

Macro code @ clojurescript:src/main/clojure/cljs/core.cljc
(core/defmacro make-array
  ([size]
   (vary-meta
     (if (core/number? size)
       `(array ~@(take size (repeat nil)))
       `(js/Array. ~size))
     assoc :tag 'array))
  ([type size]
   `(cljs.core/make-array ~size))
  ([type size & more-sizes]
   (vary-meta
     `(let [dims#     (list ~@more-sizes)
            dimarray# (cljs.core/make-array ~size)]
        (dotimes [i# (alength dimarray#)]
          (aset dimarray# i# (apply cljs.core/make-array nil dims#)))
        dimarray#)
     assoc :tag 'array)))