This has some relation to this question:
I am trying to get a slice/subarray of an N-dimensional array.
The slices are, by construction, vectors of known length, but for the sake of generality let's supposed they are some arrays of lower rank M<N, whose dimensions are known a-priori.
I want to operate on these slices (as arguments) for functions that takes Array of rank M or a Vec, rather than an Array with a bunch of singelton dimensions (so Vec and not Array{N} with dimensions (n,1,1,1,1...)).
For example I would like to have view(A,indx...) return a reference (SubArray?) with rank 1 and size (n,) and not rank M with (n,1,1,1,...).
I understand that view naturally keeps the type of A to be type-stable, but I really do not want to make the functions work on arguments of size (n,1,1,1,...)...
And of course, defining an array of the correct size and going through the setindex! path is almost certain slower.
Any suggestions / ideas / wisdom?