# Assigining values after the Apply operator

I am writing a script where I need many variables and for ease of usage I denote them as f[k,l,m,n]. I create a list of 4-tuples with the integers I need and I call these values using f@@{k,l,m,n}.

My problem is that I also need to assign values but writing f@@{k,l,m,n}=1 returns an error, declaring that the Tag Apply is protected. Is there any way to overcome this or do I need to assign my values using f[k,l,m,n]=1?

Since Set have HoldFirst Attribute, f @@ {k, l, m, n} will not be evaluated. You can do
Evaluate[f @@ {k, l, m, n}] = 1

• @tst You can assign like Do[Set[Evaluate[f @@ t], g[t]], {t, tuples}] in a loop, whatever the values g are ... – BoLe Jul 11 '16 at 13:35
• @Kuba Or this: TraceScan[# /. _[expr_] :> Unset[expr] &, f @@ {k, l, m, n}] // Quiet (but this is actually terrible) – happy fish Jul 11 '16 at 13:45