Symmetric difference: Difference between revisions

→‎{{header|Elixir}}: change HashSet(deprecated) -> MapSet
(Adding Apex example)
(→‎{{header|Elixir}}: change HashSet(deprecated) -> MapSet)
Line 637:
 
=={{header|Elixir}}==
{{works with|Elixir|1.2}}
<lang elixir>iex(1)> a = Enum.into(~w([John Bob Mary Serena),] |> HashSetMapSet.new)
#HashSet<["Mary", "Serena", "John", "Bob"]>
#MapSet<["Bob", "John", "Mary", "Serena"]>
iex(2)> b = Enum.into(~w(Jim Mary John Bob), HashSet.new)
#HashSet<["Mary",iex(2)> "b = ~w[Jim", "Mary John", "Bob"] |> MapSet.new
#HashSetMapSet<["MaryBob", "SerenaJim", "John", "BobMary"]>
iex(3)> sym_dif = fn(a,b) -> SetMapSet.difference(SetMapSet.union(a,b), SetMapSet.intersection(a,b)) end
#Function<12.9007214854118792/2 in :erl_eval.expr/5>
iex(4)> sym_dif.(a,b)
#HashSetMapSet<["SerenaJim", "JimSerena"]></lang>
 
=={{header|Erlang}}==
Anonymous user