在F#中,Array2Ds打印不正确吗?

时间:2015-03-17 17:21:48

标签: f#

我执行以下操作,期望看到3行和4列:

let my2DArray = Array2D.init 3 4 (fun x y -> (x,y))

但是当我在交互式窗口中运行它时,输出是:

val my2DArray : (int * int) [,] = [[(0, 0); (0, 1); (0, 2); (0, 3)]
                                   [(1, 0); (1, 1); (1, 2); (1, 3)]
                                   [(2, 0); (2, 1); (2, 2); (2, 3)]]

行和列不是换位的吗?我希望有三行四列。它在内存中按预期工作:

> my2DArray.[2,0];;
val it : int * int = (2, 0)

我是在考虑还是在想这个错误?

1 个答案:

答案 0 :(得分:3)

确实打印了3行4列。列是垂直的,行是水平的。

enter image description here

相关问题