About array with dimension>3

I found the construction of high-dimension array very problematic. It is not friendly if you want to create a high-dimensional (dim>3) array by hand. Also, the column major will lead to extra complications here, for example:

julia> a=reshape([1,2,3,4,5,6,7,8],(2,2,2))
2×2×2 Array{Int64,3}:
[:, :, 1] =
 1  3
 2  4

[:, :, 2] =
 5  7
 6  8

which is a little conter-intuitive as we expect

2×2×2 Array{Int64,3}:
[:, :, 1] =
 1  2
 3  4

[:, :, 2] =
 5  6
 7  8

Also, can’t we create a high-dimension array from nested list?

In conclusion, my questions are how to construct high-dimension matrices and how to understand the column major problem in high-dimension arrays.

You can – please provide an example so that we can help with code.

That said, I would just

  1. use a flat vector of elements in the desired nesting (eg “row-major”),
  2. reshape, and
  3. use permutedims

Eg

julia> permutedims(reshape(1:12, 2, 2, 3), [3, 2, 1])
3×2×2 Array{Int64,3}:
[:, :, 1] =
 1   3
 5   7
 9  11

[:, :, 2] =
  2   4
  6   8
 10  12

I noticed I misunderstood the column major behaviour. The result julia provided is very reasonable. Thank you any way.