Reputation: 14448
I have a large list that looks essentially like this:
let someList = [ [(1,2);(2,3);etc]; [(1,2);(2,3);etc]; etc]
a list that contains lists, that contain tuples. what is the best way to reduce that into a single list of all the tuples?
Upvotes: 1
Views: 398
Reputation: 22297
There's a built-in function for this, List.concat
[[(1,2); (3,4)]; [(5,6); (7,8)] ] |> List.concat
Upvotes: 10
Reputation: 16782
let l = [[(1,2); (3,4)]; [(5,6); (7,8)] ]
let flattened = List.collect id l // [(1, 2); (3, 4); (5, 6); (7, 8)]
Upvotes: 1