Broadcasting (f.(x, y, z, ...)) works for any number of dimensions, and will expand into ℝⁿ (or other n-dimensional spaces), but you need to get your inputs in the right shape first. So if you want z to lie in the third dimension, you can do
z = reshape(1:3, 1, 1, :)
If you need to do this for arbitrarily high dimensions, it becomes tedious, and @greg_plowman’s solutions is more convenient. If your data is already in the right shape, then it’s better to just use f.(x, y, z, ...).
Obviously, it does not want to be an alternative to the solution with product, but maybe could be useful in other cases to have a generalization (perhaps made better) of this type:
g(a,b,c)=a^2+b+c-1
r(p,v)=reshape(v, ntuple(e-> e < p ? 1 : length(v), p))
v1=1:4
v2=6:10
v3=2:5
V=[v1,v2,v3]
g.(map(((i,v),)->r(i,v), enumerate(V))...)
another way to define the position based reshaping function …