double-array

clojure.core

  • (double-array size-or-seq)
  • (double-array size init-val-or-seq)
Creates an array of doubles

1 Example top

  • ;; create a double array using double-array
    ;; and show it can be used with the standard Java functions
    ;; binarySearch and fill
    
    user=> (def ds (double-array (range 3 20)))
    #'user/ds
    user=> (type ds)
    [D
    user=> (vec ds)
    [3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0]
    user=> (java.util.Arrays/binarySearch ds 10.0)
    7
    user=> (java.util.Arrays/fill ds 3 8 99.0)
    nil
    user=> (vec ds)
    [3.0 4.0 5.0 99.0 99.0 99.0 99.0 99.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19
    .0]
    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:4634 top

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

Comments top

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