JaggedCollection.transpose
results in wrong result when applied to rows of varying length #319
Closed
Description
Transpose operations as in JaggedArray.transpose
and JaggedList.transpose
should be applied to collections of equal length. When collections exist, that are longer than the first one, they get truncated:
let a = [|
[|1; 2; 3|]
[|1; 2; 3; 4|]
|]
JaggedArray.transpose a
//[| [|1; 1|]; [|2; 2|]; [|3; 3|]|]
When the first element is the longest, an error is thrown:
let a2 = [|
[|1; 2; 3; 4|]
[|1; 2; 3|]
|]
JaggedArray.transpose a2
//throws: System.IndexOutOfRangeException: Index was outside the bounds of the array.
The following additions should be made
- add XML documentation that describes the requirements
- add checks that all collections are of the same size
- add unchecked
transpose_
versions, that work as before
Metadata
Assignees
Labels
No labels