I have an (unknown) number of arrays, stored in an array:
arrays = [[1,2,3],[1,2,3,4],[1,2,3,4,5]] # In this case three
I want to create a multidimensional array, with one dimension for each array (so I don’t know the dimension). In each element of my new array, I want to have some element that is a function of the corresponding elements in the array:
function my_func(input) return sum(input) end
In the case when I know the number of input arrays I can do this easily, e.g.
array_3d = [my_func([e1,e2,e3]) for e1 in arrays, e2 in arrays, e3 in arrays]
but If I don’t know the number of arrays in my array, I don’t know how to do this.