[Haskell-cafe] ANN: signed-multiset-0.1

Sjoerd Visscher sjoerd at w3future.com
Mon Apr 23 23:50:29 CEST 2012


On Apr 23, 2012, at 7:04 PM, Stefan Holdermans wrote:

> if this is what people have agreed on to be a sensible semantics for hybrid sets, I am fine implementing it like this.

I have a hard time believing you have implemented the semantics that people have agreed on to be a sensible semantics for hybrid sets.

I would expect that multiplicity k (m `union` n) == multiplicity k m `max` multiplicity k n. Which means that an element of m with negative multiplicity is not a member of m `union` n if it is not a member of n. So that would mean that union would have to be implemented something like this:

SMS m `union` SMS n = SMS $ Map.intersectionWith max m n `Map.union` Map.filter (>= 0) ((m Map.\\ n) `Map.union` (n Map.\\ m))

greetings,
Sjoerd


More information about the Haskell-Cafe mailing list