On 2009-04-13 01:53:41 -0400, bearophile <[email protected]> said:
(Incidentally, I also think the natural set operations, like
intersection and mutual exclusion, are just as handy for maps as for sets.)
It's less semantically clean to define certain set operations on AAs,
because for example you have to decide what to do when keys are equal
but their values are not.
You could pass an alias to a function that would perform the merge
between values. That way, there's not ambiguity.
You can avoid such semantic troubles altogether performing set
operations just only on the lazy view of the keys.
That'd require two passes: one for the keys, a second for getting the
values from both sides (merging the values). It's going to be less
efficient.
--
Michel Fortin
[email protected]
http://michelf.com/