# Evaluating the 1st argument of Set

I want to assign a certain value to an element of a tensor. This element is identified by an array obtained from some evaluations, so we fix it. Here i present an oversimplified core part of my code:

DimensionA = 3;
v = {1, 2, 3};
Array[TensorA, Table[10, DimensionA], 0];
TensorA @@ v = 12;


at this point i receive an error

Set::write: Tag Apply in TensorA@@{1,2,3} is Protected.

Obviously if i do TensorA[1, 2, 3] = 12; it is all ok, but my aim is to give in input a vector with an arbitrary number of indices. Please show me how I should input the vector to the tensor without receiving this error.

• Note that half the code in this question is extraneous. v = {1, 2, 3}; Evaluate[TensorA @@ v] = 12 is sufficient to set TensorA[1, 2, 3] to 12. – bbgodfrey Oct 7 '18 at 17:31
• Thank you, here there is good related answer right here : mathematica.stackexchange.com/questions/183259/… – Mordin Solus Oct 7 '18 at 20:25
• I wrote it but did not post a similar answer here, because it would have been the same as the one by @ThatGravityGuy. Thank you for the kind words. – bbgodfrey Oct 7 '18 at 20:39

Just force the Apply before Set.
Evaluate[TensorA @@ v] = 12

Also for the dimensions specification Table[10, DimensionA], I suggest using ConstantArray[10, DimensionA] instead.