(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 l# (alength a#)
~ret (aclone a#)]
(loop [~idx 0]
(if (< ~idx l#)
(do
(aset ~ret ~idx ~expr)
(recur (unchecked-inc ~idx)))
~ret))))