显然在.Net中,多维数组是IEnumerable(非泛型),因此这有效:
let a2 = Array2.init 2 3 (fun x y -> (x+1)*(y+1)) let l = a2 |> Seq.cast |> Seq.fold (fun l n -> n :: l) [] printfn "%A" l
编辑:正如Noldorin在评论中指出的那样,这甚至更好:
let l = a2 |> Seq.cast |> Seq.toList