When I try to Thread
Part
function over two nested arrays, the operation is performed as expected but i get a warning. I'm not sure if (and what) am I doing wrong. The code example is below.
lst1 = {{5, -9, 15}, {12, -15, 4}}
indices={{2,1,3},{1,3,2}}
Thread[Part[lst1,indices]]
and the output is
{{-9, 5, 15}, {12, 4, -15}}
as expected. However, the following warning was thrown.
Part::pkspec1: The expression {{2,1,3},{1,3,2}} cannot be used as a part specification. >>
Shouldn't Part
be threaded over the list as described in the help under Thread
function?
MapThread[Part, {lst1, indices}]
... $\endgroup$Thread[myPart[lst1,indices]] /. myPart -> Part
. I don't know if it is a good practise. $\endgroup$