(a: Set<A>, b: Set<A>)
| 4 | * Note: this code is hot, so is optimized for speed. |
| 5 | */ |
| 6 | export function difference<A>(a: Set<A>, b: Set<A>): Set<A> { |
| 7 | const result = new Set<A>() |
| 8 | for (const item of a) { |
| 9 | if (!b.has(item)) { |
| 10 | result.add(item) |
| 11 | } |
| 12 | } |
| 13 | return result |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Note: this code is hot, so is optimized for speed. |