1.3.0 permalink Arrow_down_16x16

long-array

clojure.core

  • (long-array size-or-seq)
  • (long-array size init-val-or-seq)
Creates an array of longs

1 Example top

  • ;; create a long array using long-array and show it can be used
    ;; with the standard Java Arrays functions binarySearch and fill
    ;; note the needed coercions
    
    user=> (def is (long-array (range 3 20)))
    #'user/is
    user=> (vec is)
    [3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19]
    user=> (java.util.Arrays/binarySearch is (long 10))
    7
    user=> (java.util.Arrays/fill is 3 8 (long 99))
    nil
    user=> (vec is)
    [3 4 5 99 99 99 99 99 11 12 13 14 15 16 17 18 19]
    user=>
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:4657 top

(defn long-array
  "Creates an array of longs"
  {:inline (fn [& args] `(. clojure.lang.Numbers long_array ~@args))
   :inline-arities #{1 2}
   :added "1.0"}
  ([size-or-seq] (. clojure.lang.Numbers long_array size-or-seq))
  ([size init-val-or-seq] (. clojure.lang.Numbers long_array size init-val-or-seq)))
Vars in clojure.core/long-array:
Used in 0 other vars

Comments top

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