Sets

Sets are implemented using the module MapSet.

 iex>​ set1 = 1..5 |> Enum.into(MapSet.new)
 #MapSet<[1, 2, 3, 4, 5]>
 iex>​ set2 = 3..8 |> Enum.into(MapSet.new)
 #MapSet<[3, 4, 5, 6, 7, 8]>
 iex>​ MapSet.member? set1, 3
 true
 iex>​ MapSet.union set1, set2
 #MapSet<[1, 2, 3, 4, 5, 6, 7, 8]>
 iex>​ MapSet.difference set1, set2
 #MapSet<[1, 2]>
 iex>​ MapSet.difference set2, set1
 #MapSet<[6, 7, 8]>
 iex>​ MapSet.intersection set2, set1
 #MapSet<[3, 4, 5]>