Set For List Comparisons in F#
May 12, 2015 2 Comments
Dear Jamie Of The Future:
Next time you want to see if there are elements in 2 different lists, use Set
1 let tags0 = Set.ofList(["A";"B";"C"]) 2 let tags1 = Set.ofList(["A";"D"]) 3 let tags2 = Set.ofList(["A";"B"]) 4 let tags3 = Set.ofList(["D"]) 5 6 Set.intersect tags0 tags1 7 Set.intersect tags0 tags2 8 Set.intersect tags0 tags3
Love, Jamie of May 2015
PS. You really should exercise more…
Also you can use standard operators like + and – to get unions etc. as well 🙂
Pingback: F# Weekly #20, 2015 | Sergey Tihon's Blog