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