1
$\begingroup$

This question already has an answer here:

I would like to do this

list = Append[list[[#]],Map[list2[[1, #]] & , list[[#, 4]], {2}]] & /@ Range[Length[list]];

But I would like to substitute list2[[1,#]] with list2[[#,#] where the first # is different from the second one, that is the first # refers to the "outer" parameter.

Is there a way to do this?

$\endgroup$

marked as duplicate by Leonid Shifrin, MarcoB, user9660, m_goldberg, Bob Hanlon May 6 '16 at 21:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    $\begingroup$ Read here and here and read documentation for Function $\endgroup$ – BlacKow May 5 '16 at 15:47
  • 1
    $\begingroup$ Is this what you want? Append[list[[#]], Map[Function[{x}, list2[[#, x]]], list[[#, 4]], {2}]] & /@ Range[Length[list]]; $\endgroup$ – march May 5 '16 at 15:48
  • $\begingroup$ @march exactly! Your solution is working! Thanks $\endgroup$ – Fabio Sist May 5 '16 at 15:59