A few years ago I posted a solution on another forum, which I will repeat here. It occurred to me that MapAt
would be the correct builtin function if it either allowed the use of All
or accepted a level specification, neither of which were valid in version 8, so I wrote my own version
MapAtLevel[f_, expr_, n_, levelspec_: {1}] :=
Map[MapAt[f, #, n] &, expr, levelspec - 1];
list = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
MapAtLevel[f, list, 3, {2}]
yields
{{1, 2, f[3]}, {4, 5, f[6]}, {7, 8, f[9]}}
This post got me interested in the problem again, so on a lark I tried the All
approach in version 9
MapAt[f, list, {All, 3}]
yields
{{1, 2, f[3]}, {4, 5, f[6]}, {7, 8, f[9]}}
So, the behavior of MapAt
has changed as of version 9, although the Doc Center has not been updated as Jens points out above. So, yet another utility function I have written to deal with Mathematica quirks has been made obsolete, and I could not be happier. Thanks for reading the forums and responding, Wolfram developers.