(double-array size-or-seq)
(double-array size init-val-or-seq)
Creates an array of doubles. Does not coerce array, provided for compatibility
with Clojure.
Source
(defn
double-array
"Creates an array of doubles. Does not coerce array, provided for compatibility\n with Clojure."
([size-or-seq]
(if
(number? size-or-seq)
(double-array size-or-seq nil)
(into-array size-or-seq)))
([size init-val-or-seq]
(let
[a (make-array size)]
(if
(seq? init-val-or-seq)
(let
[s (seq init-val-or-seq)]
(loop
[i 0 s s]
(if
(and s (< i size))
(do (aset a i (first s)) (recur (inc i) (next s)))
a)))
(do (dotimes [i size] (aset a i init-val-or-seq)) a)))))