If the function passed to MapIndexed references the first (or data) argument, the following performs as expected:
MapIndexed[#2 &, 1 -> {2 -> {3 -> 4}}, Infinity]
As well as
MapIndexed[(#1; #2) &, 1 -> {2 -> {3 -> 4}}, Infinity]
yield:
{1} -> {2}
Not respecting the Infinity level spec,
whereas:
MapIndexed[{#1, #2} &, 1 -> {2 -> {3 -> 4}}, Infinity]
gives
{1, {1}} -> {{{{2, {2, 1,
1}} -> {{{{3, {2, 1, 2, 1, 1}} -> {4, {2, 1, 2, 1, 2}}, {2, 1,
2, 1}}}, {2, 1, 2}}, {2, 1}}}, {2}}
MapIndexed[#2 &, 1 -> {2 -> {3 -> 4}}, Infinity]
.#2&
is loosing information about#
so this is what I'd expect, isn't it? $\endgroup$MapIndexed
acts depth-first, leaves before branches. No idea why this one was down voted. $\endgroup$MapIndexed[#2 &, {a, {b, c}}, Infinity]
$\endgroup$