ClojureDocs

Nav

Namespaces

amap

clojure.core

Available since 1.0 (source)
  • (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.
1 Example
(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.
See Also

Reduces an expression across an array a, using an index named idx, and return value named ret, ini...

Returns a lazy sequence consisting of the result of applying f to the set of first items of each c...

Added by gstamp
0 Notes
No notes for amap