I have an initial "multidimensional" list (that is, a list that is not a vector):
list0 = {{1},{2,3,4},{3,4},{5}};
and I want to insert elements x,y,z
at specific positions {1,1}
, {2,3}
, {4,2}
, to obtain the resulting list:
{{x,1},{2,3,y,4},{3,4},{5,z}}
That is, the list of positions {1,1}
, {2,3}
, {4,2}
gives the positions in the resulting list.
What's a clean way to do this?
This is a generalization of Insert at specific resulting positions?, which is a one-dimensional version of this question.
Insert
so:... {2, x, 3, y, 4}...
or rather{2, x, y, 3, 4}
? Where the latter is maybe intuitive but not consistent withInsert
. $\endgroup$