How can we embed a counter in the Map
function?
Consider a data set such as data = {{a, b, c, d}, {e, f}, {g, h, i}}
. The desired function would output
{{0, a}, {0, b}, {0, c}, {0, d}, {1, e}, {1, f}, {2, g}, {2, h}, {2, i}}
Responders are not constrained to use Map
.
N.B. The answer does not appear to be in Indexed Map Thread.