Jump to content

Symmetric difference: Difference between revisions

→‎{{header|Julia}}: A new entry for Julia
m (Added Sidef language)
(→‎{{header|Julia}}: A new entry for Julia)
Line 1,168:
Example:<lang jq>symmetric_difference( [1,2,1,2]; [2,3] )
[1,3]</lang>
 
=={{header|Julia}}==
Julia has a built-in <code>Set</code> type that supports elementary set operations, including <code>symdiff</code>.
<lang Julia>
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)
</lang>
 
{{out}}
<pre>
Set a is: Set{ASCIIString}({"John","Mary","Bob","Serena"})
Set b is: Set{ASCIIString}({"Jim","Mary","John","Bob"})
Their symmetric difference is: Set{ASCIIString}({"Jim","Serena"})
</pre>
 
=={{header|K}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.