Aesthetically and mathematically a map(f, X) function seems great: in just two arguments it tells what is going to happen: we are going to use function f to transform each element from X to create a new array Y.
However I do not know what is happening under the bonnet of either for or map; and my reasons for liking map could be argued to be superficial. Is one any more efficient than the other?
Note: the question is not about micro-optimisation: the question is a broad (multi-criterion) comparison between two specific methods (that seem to achieve the same objective) and why would one use one or another.
I'd also note that there is also an implicit immutable vs mutable data issue here. again I'd lean toward immutability as easier to get correct moving to a mutable solution only if it was required
– jk. Aug 17 '17 at 08:55