@@ -42,10 +42,15 @@ export
4242difference : (x, y : SortedSet k) -> SortedSet k
4343difference x y = foldr delete x y
4444
45−||| Set intersection. Uses the union of the differences.
45+||| Set symetric difference. Uses the union of the differences.
46+export
47+symDifference : (x, y : SortedSet k) -> SortedSet k
48+symDifference x y = union (difference x y) (difference y x)
49+
50+||| Set intersection. Implemented as the difference of the union and the symetric difference.
4651export
4752intersection : (x, y : SortedSet k) -> SortedSet k
48−intersection x y = union (difference x y) (difference y x)
53+intersection x y = difference (union x y) (symDifference x y)
4954
5055Ord k => Semigroup (SortedSet k) where
5156 (<+>) = union