containers: symmetricDifference for Set and HashSet
David Feuer
david.feuer at gmail.com
Tue Dec 1 09:18:44 UTC 2020
This has been raised before. I'm going to try to look at implementation
within the next week or so.
On Tue, Dec 1, 2020, 4:17 AM Ben Franksen <ben.franksen at online.de> wrote:
> Would it make sense to add a function like the following to containers:
>
> symmetricDifference :: Set a -> Set a -> (Set a, Set a, Set a)
> symmetricDifference a b = (a \\ b, a `intersection` b, b \\ a)
>
> with the idea that this can be implemented more efficiently as a
> primitive than the above specification? (And similarly for HashSet.)
>
> If this is the case, then perhaps difference and intersection could be
> defined in terms of this new primitive:
>
> difference a b = let (r, _, _) = symmetricDifference in r
> intersection a b = let (_, r, _) = symmetricDifference in r
>
> *if* it turns out that this does not degrade performance.
>
> Cheers
> Ben
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20201201/caedca63/attachment.html>
More information about the Libraries
mailing list