Reputation: 1248
Suppose I have a sequence of int arrays, all of the same dimension;
I wish to create a 2D array in which each line n of the 2D array is the nth term in the sequence.
for example, if my sequence is
{[|1 ; 2; 3|] , [|4 ; 5; 6|] , [|7 ; 8; 9|]}
the function should return a 2D array
[|[|1;2;3;],[|4 ; 5; 6|],[|7 ; 8; 9|]|]
Upvotes: 1
Views: 942
Reputation: 25516
Slightly changing your sequence shows the easiest way (which will work with any combination of inner sequences / arrrays / lists
let t =array2D [[|1 ; 2; 3|] ; [|4 ; 5; 6|] ; [|7 ; 8; 9|]];;
Upvotes: 1