let l =
[
1,2
1,5
2,1
2,2
1,1
]
let res = System.Collections.Generic.Dictionary()
for x, y in l do
match res.TryGetValue(x) with
| false, _ -> res.Add(x, ResizeArray([y]))
| true, ys -> ys.Add(y)