how to open seq<seq<...>> or another way making Seq.collect(fun x -> x)
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
).
精彩评论