julia> f(i,j,k) = i+j+k
f (generic function with 2 methods)
julia> [f(i,j,k) for i in 1:2, j in 1:2, k in 1:2]
2×2×2 Array{Int64,3}:
[:, :, 1] =
3 4
4 5
[:, :, 2] =
4 5
5 6
The last idea is pretty close to that what I’m looking for. Is there any chance to realize it without “for” or “cat” just jusing “”,;(){}‘’ or something similar?
No, I don’t think so. The various cominations of [], ;, and space are just syntactic sugars that get lowered into hcat, vcat, or hvcat, all of which operate only along the first or second dimension. They’re not any more efficient than calling cat yourself, just easier to type. I’d suggest wrapping up whatever construction you want to do in a function (using one of the solutions above), and then just calling that function.
Tanks to your hint I found a solution that works pretty good for me, because you just need to edit the (3, 3) to increase/decrease the dimension (less work):