Consider a list, e.g.:
list = {a,b,c,d};
One can compose a Table by directly iterating through the list:
tab = Table[
(*do something with i*)
,{i,list}]
This is useful, since we iterate through all elements in list without introducing an integer counter and notationally cleaner without having to deal with parts list[[...]]. However, sometimes we need to refer back to the position of i in list. Is there a convenient way to know the position of each i within list without calling Position[list,i]? What I mean is, does the iterator store and provide this information as well, so that there is some way to call it directly?
Table[With[{i = list[[idx]]}, (* do something with i *)], {idx, Length@list}]seems efficient enough, but there isMapIndexed[]. In any case, AFIAK, neither your form ofTablenorMapmakes the index available. – Michael E2 Jul 16 '17 at 02:46