[Haskell-cafe] Map unionWith generalization
Twan van Laarhoven
twanvl at gmail.com
Wed Jan 27 21:09:49 EST 2010
Hans Aberg wrote:
> For example, in Map String Integer (sparse representation of monomials)
> compute the minimum value of all associative pairs with the same key
> (the gcd); if only one key is present, the absent should be treated as
> having value 0. So
> unionWith min xs ys
> will not work, because unionWith will always apply the identity to the
> remaining value when one key is missing, whereas it should be sent to 0.
If missing keys represent 0, then wouldn't this work?
intersectionWith min xs ys
Twan
More information about the Haskell-Cafe
mailing list