Join GitHub today
GetSlice for 3D (possibly 4D) arrays. #700
Extending multidimensional array types with a GetSlice method
This is my first suggestion (ever), so I apologize if this is not the correct method of suggesting such an implementation.
My current solution for implementing a GetSlice method on a 3D array is to use a type extension:
Currently, slicing syntax for a 3D array only supports the Item method, in which
I can't think of a reason as to why this method wouldn't exist in the core library, but it would be a welcome addition. For such basic functionality when working with an array, this could likely be implemented much more elegantly than my attempt.
Pros and Cons
The advantage of making this adjustment to F# is more flexibility when using multidimensional arrays, especially when trying to work on a volume slice-by-slice. Including this type extension in every project seems to introduce an unnecessary degree of boilerplate.
I can't think of any disadvantages.
Estimated cost (XS, S, M, L, XL, XXL): XS
Related suggestions: #662
Please tick this by placing a cross in the box:
Please tick all that apply:
The leaf arrays in jagged arrays are of different length, they aren't the same as full dimensions in rectangular arrays. Also, the syntax of creating and modifying them are different. Thinking of it a bit more, I'd guess your proposal should only apply to the true dimensions of arrays and not to the jagged leaves of jagged arrays.
Jagged arrays with each leaf of the same length can behave the same as true multidimensional arrays, and are sometimes preferred because in many cases their performance characteristics are superior to multidimensional arrays.