[m-dev.] map.merge
    Julien Fischer 
    juliensf at csse.unimelb.edu.au
       
    Wed Jul 12 15:01:13 AEST 2006
    
    
  
On Mon, 10 Jul 2006, Ian MacLarty wrote:
> The documentation of map.merge says:
>
>    % For map.merge(MapA, MapB, Map), MapA and MapB must not both
>    % contain the same key.
>    %
> :- func map.merge(map(K, V), map(K, V)) = map(K, V).
> :- pred map.merge(map(K, V)::in, map(K, V)::in, map(K, V)::out) is det.
>
> However it doesn't say what happens if they do have the same key.  I
> investigated and it appears that map.merge won't throw an exception if
> the same key appears in both maps, but will set the corresponding value
> to the greatest value from the two maps.  Wouldn't it be more
> appropriate to throw an exception?
I would say yes, unless it adversly affects the performance of map.merge.
Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
    
    
More information about the developers
mailing list