如何连接字符串选项列表?
let m = [ ""; "12"; "a"; "b"]
// I can join these with
m |> List.toSeq |> String.concat "\n"
// now I got a list of string option list
let l = [Some ""; None; Some "a"; Some "b"]
l |> List.toSeq |> ????
Run Code Online (Sandbox Code Playgroud)
首先使用List.choose "提取"列表的某些值:
l |> List.choose id |> String.concat "\n"
Run Code Online (Sandbox Code Playgroud)
请注意,您不需要,List.toSeq因为seq是IEnumerable的别名,并且列表已经实现了它.