[Haskell-cafe] Symmetric Difference for Data.Set and Data.IntSet?

Clinton Mead clintonmead at gmail.com
Mon Jun 22 04:35:36 UTC 2015


I think he means

symmetricDifference a b = (a `union` b) `difference` (a `intersection` b)

Or equivalently

symmetricDifference a b = (a `difference` b) `union` (b `difference` a)

Basically the elements in one of the two sets but not both. He's claiming a
direct function would be faster than combining three.

Note that (a `difference` b \= b `difference` a) but (a
`symmetricDifference` b == b `symmetricDifference` a).


On Sun, Jun 21, 2015 at 3:15 PM, Ruben Astudillo <ruben.astud at gmail.com>
wrote:

>
> On 20/06/15 21:49, Zemyla wrote:
>
>> Alternatively, could we get a merge interface for Set and IntSet roughly
>> matching Map and IntMap?
>>
>
> Could you expand on what you mean? I understand it as that having
> operations of
> (Int)Map for (Int)Set, why don't just use (Int)Map then?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150622/64bca417/attachment.html>


More information about the Haskell-Cafe mailing list