D3migod
D3migod

Reputation: 319

Hot to make array of elements from array of tuples in fsharp

The goal is to make from for example from [(1,2),(3,4),(5,6)] this array [|1,2,3,4,5,6|]. Msdn gives a simple example of Array.collect's usage. I tried to do the same with

x |> Array.collect (fun (a,b) -> [|a,b|]) 

but it still returns (a,b)[]. Thanks for the help in advance.

Upvotes: 0

Views: 592

Answers (1)

Petr
Petr

Reputation: 4280

Your lambda creates array of one tuple [|a,b|] You need array of two elements: (fun (a,b) -> [|a; b|]) Elements in collections are divided by ;

Upvotes: 8

Related Questions