From: Nicolas C. <war...@fr...> - 2005-06-06 08:08:20
|
>> After a second though I think it's little overweighted to make the user >> specify a merge function. Why not simply specify that in such cases, the >> item of the first map is selected ? That seems more reasonable. >> > >No, you can for instance implement multiset as map to natural ... and >the merge function is then addition. > >Your merge function should even raise the exception Remove when you want >to say that the result should be removed from the map ... (For insance, >if you have Map to integer and want to say that 0 should be removed from >the map). I would say it's bad API design to use a "merge" function in order to remove elements. A more specific function should be provided. Nicolas |