简体   繁体   中英

F# Multidimensional array comprehensions

Is there a syntax for creating multidimensional array using comprehensions is F#? This is really easy for jagged arrays:

let weights1 = [|
                  [|3.0|]
                  [|1.0|]
               |]

Sure that I can than convert this jagged array to multidimensional array:

let weights = Array2D.init 2 2 (fun i j -> weights1.[i].[j])

But isn't there a syntax way of doing the same?

使用array2D MSDN运算符,传递一系列序列(或锯齿状数组):

array2D [[3.0]; [1.0]]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM