export const intersect = (xs: Set, ys: Set): Set => { const out: Set = new Set() xs.forEach(x => { if (ys.has(x)) { out.add(x) } }) return out } export const setEquals = (xs: Set, ys: Set): boolean => { if (xs.size != ys.size) { return false } for (const x of Array.from(xs)) { if (!ys.has(x)) { return false } } return true }