3 ms·
"No built-in type for sets (have to use maps and test for existence)... In absence of sets, have to write your own intersection, union etc. methods" In my mind
by 16s 13y ago
"No built-in type for sets (have to use maps and test for existence)... In absence of sets, have to write your own intersection, union etc. methods"
In my mind, a map is a set. They are both Associative containers. It's just that the key and value can be different things in a map while in a set, the key and value are the same thing.
Edit: I speak from a strong C++ viewpoint, but maybe Go is not like that (I'm not sure why it would not be): https://en.wikipedia.org/wiki/Associative_containers_%28C%2B%2B%29 https://en.wikipedia.org/wiki/Associative_containers_%28C%2B...
- RHSeeger 13y agoBy that logic, a map is just a list where every odd element is a key and every even element is a value. There are semantic differences between maps and sets and lists. Just because you can use one to represent all the others doesn't remove the benefit of having all 3 available.