开发者

how to open seq<seq<...>> or another way making Seq.collect(fun x -> x)

开发者 https://www.devze.com 2023-03-07 15:05 出处:网络
dashboard.Grid |> Seq.mapi ^-^ fun y sx -> sx|> Seq.mapi ^-^ fun x s -> if not <| s.IsEmpty && s.CellState.Color = color then
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
      开发者_Go百科              None
            else None
        else None
    |> Seq.choose id
|> Seq.collect(fun x -> x)
|> Seq.collect(fun x -> x)

So, I just thing the last part (2 strings) of this sequence is weird. Can I open sequence another way ? List.ofSeq() doesn't work here.

thank you.


I think you're looking for Seq.concat, which is the same as Seq.collect(fun x -> x) (or Seq.collect id).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号