Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,8 @@
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"]>

View file

@ -0,0 +1,7 @@
a = Set(["John", "Bob", "Mary", "Serena"])
b = Set(["Jim", "Mary", "John", "Bob"])
c = symdiff(a, b)
println("Set a is: ", a)
println("Set b is: ", b)
println("Their symmetric difference is: ", c)