9 lines
386 B
Plaintext
9 lines
386 B
Plaintext
iex(1)> a = Enum.into(~w(John Bob Mary Serena), HashSet.new)
|
|
#HashSet<["Mary", "Serena", "John", "Bob"]>
|
|
iex(2)> b = Enum.into(~w(Jim Mary John Bob), HashSet.new)
|
|
#HashSet<["Mary", "Jim", "John", "Bob"]>
|
|
iex(3)> sym_dif = fn(a,b) -> Set.difference(Set.union(a,b), Set.intersection(a,b)) end
|
|
#Function<12.90072148/2 in :erl_eval.expr/5>
|
|
iex(4)> sym_dif.(a,b)
|
|
#HashSet<["Serena", "Jim"]>
|