A "high-level" language for the Gameboy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
444 B

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