how to transform a list in a sequence of arguments?

*To*: mathgroup at smc.vnet.net*Subject*: [mg77216] how to transform a list in a sequence of arguments?*From*: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>*Date*: Tue, 5 Jun 2007 07:03:54 -0400 (EDT)

I believed it was fairly trivial, yet I was unable to find a solution ... say I have a 3d matrix, In[64]:= s Dimensions[s] Out[64]= {{{-1, 1, 1}, {-1, 1, 1}, {-1, 1, 1}}, {{1, 1, 1}, {1, 1, 1}, {1, -1, -1}}, {{1, -1, 1}, {-1, 1, -1}, {-1, 1, -1}}} Out[65]= {3, 3, 3} and I want to access&modify it in a procedure, in which the indices i,j,k are found sequentially: {1,1,1}, {1,1,2}, .... How can I do it, since s[[{i,j,k}]] is not the same - of course - of s[[i,j,k]] ??? I finally wrote the construct: Apply[s[[##]] &, {i,j,k}] ant this works OK in reading, but not in writing since it reports: s[[##]] & @@ {1,2,1} = "0" Set::write: Tag Apply in (s[[##1]]&)@@{1,2,1} is Protected. >> any idea on how to make it work read/write??? P.S. it <does> work, for now, because I'm using this (where i0 is the indices list): s = ReplacePart[s, i0 -> - Extract[s, i0]]; but I fear that it must be much slower than a Part[] access Thank you! Alessandro Magni