Unfortunately, there is no drop-in Seq.unzip included in the language, although there are equivalents for lists ( List.unzip ) and arrays ( Array.unzip ).
There are several ways to define such a function, one of which is:
let unzip sequence = let (lstA, lstB) = Seq.foldBack (fun (a,b) (accA, accB) -> a::accA, b::accB) sequence ([],[]) (Seq.ofList lstA, Seq.ofList lstB)
Alternatively, if you do not need to switch between the list, you can simply:
let item1, item2 = let it1, it2 = foo |> List.ofSeq |> List.unzip (Seq.ofList it1, Seq.ofList it2)
source share