2011-05-23 30 views
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()在這裏不起作用。如何打開SEQ <seq<...>>或另一種方式使Seq.collect(有趣X - > X)

謝謝。

回答

4

我認爲您正在尋找Seq.concat,這與Seq.collect(fun x -> x)(或Seq.collect id)相同。

相關問題