如何打开 seq<seq<...>> 或其他方式使 Seq.collect(fun x -> x)

cnd*_*cnd 1 f# sequences sequence seq

dashboard.Grid
|> Seq.mapi ^-^ fun y sx -> 
    sx  |> Seq.mapi ^-^ fun x s -> 
        if not <| s.IsEmpty && s.CellState.Color = color then 
            let psteps = s.CellState.motion( dashboard, new SPosition(x,y), color )
            if psteps <> null then
                if psteps.IsEmpty then
                    Some(psteps)
                else
                    None
            else None
        else None
    |> Seq.choose id
|> Seq.collect(fun x -> x)
|> Seq.collect(fun x -> x)
Run Code Online (Sandbox Code Playgroud)

所以,我只是觉得这个序列的最后一部分(2 个字符串)很奇怪。我可以用另一种方式打开序列吗?List.ofSeq() 在这里不起作用。

谢谢你。

Rob*_*ert 5

我认为您正在寻找Seq.concatSeq.collect(fun x -> x)(或Seq.collect id)相同的。