long-array
(long-array size-or-seq)
(long-array size init-val-or-seq)
Source docstring:
Creates an array of longs. Does not coerce array, provided for compatibility
with Clojure.
(defn long-array
([size-or-seq]
(if (number? size-or-seq)
(long-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)))))