Functions can be defined via
f[x1_, x2_] := x1^2 + x2^2
But how can I manage it to define a function depending on an array?
I would like to do something like
because the length of the array varies in my application.