on master help sign in
Fixed the intersection to actually be the intersection instead of the symmetric diference

Thanks @Melvar!

commitd5b8435189636174663dc8505344a23edce19cae authorSynthetica9 <patrickhilhorst97@gmail.com> dateWed 19 Apr 2017, 14:26 (10 years ago) parentf9c5d9a
1 file changed+7−2
libs/contrib/Data/SortedSet.idr+7−2
libs/contrib/Data/SortedSet.idr+7−2
@@ -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