Consider for example the nested association:
myA = <|"d" -> <|"c" -> <|"a" -> 1, "b" -> 2|>|>|>
It is easy to map a function to a key on the first level:
MapAt["c" /. # &, myA, "d"]
but MapAt doesn't work with levels higher than 1
MapAt["a" /. # &, myA, "c"]
So I tried a workaround, trasforming all the associations to lists:
Replace[
myA /. Association -> ass
,
Rule["c", x_] -> Rule["c", ("a" + "b") /. x], Infinity
] /. ass -> Association
getting the correct result, but with some errors that I can't fix
I've tried with Hold, but it looks like it works at level 1 only.
Thank you for your help!
"c" /. # &
? p.s. it would help to have desired results presented as it is not clear what is the ultimate goal. $\endgroup$MapAt["a" /. # &, myA, {All, "c"}]
? $\endgroup$