Skip to content
Subhajit Sahu edited this page Dec 2, 2022 · 18 revisions

Obtain values present in any set.

Alternatives: union, union$.
Similar: union, intersection, difference, symmetricDifference, isDisjoint.


function union$(x, y)
// x: a set (updated)
// y: another set
const set = require('extra-set');

var x = new Set([1, 2, 3]);
var y = new Set([2, 3, 4]);
set.union$(x, y);
// → set(4) { "a" => 1, "b" => 2, "c" => 3, "d" => 40 }

x;
// → set(4) { "a" => 1, "b" => 2, "c" => 3, "d" => 40 }


References