Created
April 24, 2017 13:15
-
-
Save shahryarjb/7fa690913bb90ad9d56182f8869c7d16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(3)> set1 = 1..5 |> | |
...(3)> Enum.into(MapSet.new) | |
#MapSet<[1, 2, 3, 4, 5]> | |
iex(4)> MapSet.member? set1, 3 | |
true | |
iex(5)> MapSet.member? set1, 6 | |
false | |
iex(6)> set2 = 3..8 |> Enum.into(MapSet.new) | |
#MapSet<[3, 4, 5, 6, 7, 8]> | |
iex(7)> MapSet.union set1 , set2 | |
#MapSet<[1, 2, 3, 4, 5, 6, 7, 8]> | |
iex(8)> MapSet.difference set1 , set2 | |
#MapSet<[1, 2]> | |
iex(9)> MapSet.difference set2 , set1 | |
#MapSet<[6, 7, 8]> | |
iex(10)> MapSet.intersection set2 , set1 | |
#MapSet<[3, 4, 5]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment