3 ms·
It seems to me that's just a map[set_key]bool
by zlynx 8y ago
It seems to me that's just a map[set_key]bool
- masklinn 8y ago1. because you can't build opaque abstractions in Go, you have to wonder if there's a difference between having a true and a false value mapped to a key 2. because sets are significantly less useful without set-operations (intersections, unions, differences) and since go does not have user-defined generics you can't build a generic version of those ( 3. because it wastes 1 byte per item (according to the comments in bmap, buckets are implemented column-major `map[K] struct{}` would fix 3 and the second half of 1 (struct{} is a zero-sized singleton) but is somewhat less ergonomic so the impact of what's left of 1 is worse, and it doesn't solve 2 at all