October 2014
Intermediate to advanced
280 pages
7h 20m
English
There is currently just one implementation of sets, the HashSet.
| | iex> set1 = Enum.into 1..5, HashSet.new |
| | #HashSet<[1, 2, 3, 4, 5]> |
| | iex> Set.member? set1, 3 |
| | true |
| | iex> set2 = Enum.into 3..8, HashSet.new |
| | #HashSet<[3, 4, 5, 6, 7, 8]> |
| | iex> Set.union set1, set2 |
| | #HashSet<[7, 6, 4, 1, 8, 2, 3, 5]> |
| | iex> Set.difference set1, set2 |
| | #HashSet<[1, 2]> |
| | iex> Set.difference set2, set1 |
| | #HashSet<[6, 7, 8]> |
| | iex> Set.intersection set1, set2 |
| | #HashSet<[3, 4, 5]> |
Read now
Unlock full access