F# Create 2D Array
Hi I am wanting to create in F# a 2D array of size 1000x1000, with the value in the array at any position to be initialized as the same vaue of its index using the 2DArray class.
i.e. position [1,1] would have value (1,1).
I have looked at the syntaxt of Array2D.create, but am n开发者_StackOverflow中文版ot sure how to use it properly...
Any help would be appreciated...
Use Array2D.init to pass a function to specify the initial value of each.
let a = Array2D.init 3 3 (fun x y -> (x,y))
printfn "%A" a
精彩评论