2011-05-23 70 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)相同。

相关问题