的名单列表我有一个数据集像这样转换逗号分隔的字符串列表,以整数
1,2
3,4
5,6
7,8
9,0
当我使用ReadAllLines我得到一个字符串数组读取它。到目前为止,我已经转换的字符串列表数组包含字符串,如
[["1";"2"];["3";"4"]... etc
我需要最后一步算一步吧,现在得到这个[[1;1;[1;4]... etc
我的代码:
module Data =
let load(path : string) (filename : string) =
System.IO.File.ReadAllLines(path + "\" + filename)
|> Array.toList
|> Seq.map (fun s -> s.Split [|','|] |> Array.toList)
|> Seq.map (fun s -> s |> Seq.map System.Int32.Parse)
这是我测试它时返回的结果
val it : seq<seq<int>> = seq [seq [1; 2]; seq [3; 4]; seq [5; 6]]
我在等待这样的事情
val zz : int list list = [[1; 2]; [3; 4]]