[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Map unionWith generalization

Subject: Re: [Haskell-cafe] Map unionWith generalization
From: Twan van Laarhoven
Date: Thu, 28 Jan 2010 03:09:49 +0100
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

Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>