aclone

clojure.core

  • (aclone array)
Returns a clone of the Java array. Works on arrays of known
types.

1 Example top

  • ;; create an Java integer array, then clone it
    ;; note that when you modify b, a remains the same
    ;; showing that b is not just a reference to a
    
    user=> (def a (int-array [1 2 3 4]))
    #'user/a
    user=> (def b (aclone a))
    #'user/b
    user=> (aset b 0 23)
    23
    user=> (vec b)
    [23 2 3 4]
    user=> (vec a)
    [1 2 3 4]
Log in to add / edit an example.

See Also top

  • 0
    clojure.core/aget

    Returns the value at the index/indices. Works on Java arrays of all

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3443 top

(defn aclone
  "Returns a clone of the Java array. Works on arrays of known
  types."
  {:inline (fn [a] `(. clojure.lang.RT (aclone ~a)))
   :added "1.0"}
  [array] (. clojure.lang.RT (aclone array)))
Vars in clojure.core/aclone:
Used in 0 other vars

Comments top

No comments for aclone. Log in to add a comment.