store/[org.clojure/clojure "1.8.0"] clj::clojure.core/amap

Official Documentation

Add notes
Arities
==================================================
   [a idx ret expr]

Docstring
==================================================
  Maps an expression across an array a, using an index named idx, and
  return value named ret, initialized to a clone of a, then setting 
  each element of ret to the evaluation of expr, returning the new 
  array ret.

Source

(defmacro amap
  "Maps an expression across an array a, using an index named idx, and
  return value named ret, initialized to a clone of a, then setting 
  each element of ret to the evaluation of expr, returning the new 
  array ret."
  {:added "1.0"}
  [a idx ret expr]
  `(let [a# ~a
         ~ret (aclone a#)]
     (loop  [~idx 0]
       (if (< ~idx  (alength a#))
         (do
           (aset ~ret ~idx ~expr)
           (recur (unchecked-inc ~idx)))
         ~ret))))

Example 1

Edit
(def an-array (int-array 25000 (int 0)))
;; => #'user/an-array

(time (amap ^ints an-array 
            idx 
            ret 
            (+ (int 1) 
               (aget ^ints an-array idx))))
;; > "Elapsed time: 14.708653 msecs"
;; => nil

;; Note: without type hinting the performance of would not be good.

Uses on crossclj