amap

added
1.0

ns
clojure.core

type
macro

(amap a idx ret expr)

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.

                (def an-array (int-array 25000 (int 0)))

user=> (time (amap ^ints an-array 
                   idx 
                   ret 
                   (+ (int 1) 
                      (aget ^ints an-array idx))))

"Elapsed time: 14.708653 msecs"

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