1
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)

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

谢谢你。

4

1 回答 1

5

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

于 2011-05-23T12:26:38.393 回答