Creating a list with Thread
The easiest way to achieve this is with MapIndexed
:
MapIndexed[
{#2[[1]], #1} &,
aaah,
{2}
]
{{{1, 11}, {1, 21}, {1, 31}}, {{2, 12}, {2, 22}, {2, 32}}, {{3, 13}, {3, 23}, {3, 33}}}
MapIndexed[Thread @ {First @ #2, #} &] @ aaah
{{{1, 11}, {1, 21}, {1, 31}}, {{2, 12}, {2, 22}, {2, 32}}, {{3, 13}, {3, 23}, {3, 33}}}
I think that the most natural way of doing this is by using MapIndexed
. But if you want to use Range
and Thread
, this is one way:
{{11, 21, 31}, {12, 22, 32}, {13, 23, 33}} //
{Length /* Range, Identity} //
Through //
Thread //
Map[Thread]