I would like to write a function that generates the expression $\sum_{i_1,\ldots,i_L} f(i_1,\ldots,i_L) \left(s_{i_1}\ldots s_{i_L}\right)$
where $i_j\in \left\{0,1,2,3\right\}$ and $s_{i_j}$ are string variables. The parameter to be passed to the function is the number of terms $L$. For example for L=2 one could generate it with
Sum[f[{j, k}] ("s" <> ToString@j <> " " <> "s" <> ToString@k), {j, 0, 3}, {k, 0, 3}]
However I would like to create a function
g[L_]:=...
That generalise the previous expression for arbitrary L. Maybe this could be done by creating a list
variables={j1,... ,jL}
which could be passed to a function of variable number of arguments as
g[variables__]:=...
? Is it a better way to do it?
{j, 0, 3}, {k, 0, 3}
, right? $\endgroup$