on master help sign in
Revert "Add "equals" functions for Set, Dict, and Array"

This reverts commit 45aa58f9d40b99bdad64e4201ebd37e6f756b2f8.

commit6f608e3ab7294de760d01d80356b4a787301e488 authorEvan Czaplicki <info@elm-lang.org> dateMon 14 Apr 2014, 22:08 (13 years ago) parent45aa58f
3 files changed+5−38
libraries/Array.elm+1−17 libraries/Dict.elm+2−14 libraries/Set.elm+2−7
libraries/Array.elm+1−17
@@ -8,7 +8,7 @@ reads, updates, and appends.
88@docs empty, repeat, initialize, fromList
99
1010# Basics
11−@docs length, equals, push, append
11+@docs length, push, append
1212
1313# Get and Set
1414@docs get, getMaybe, getWithDefault, set
@@ -103,22 +103,6 @@ foldr = Native.Array.foldr
103103empty : Array a
104104empty = Native.Array.empty
105105
106−{-| Check if all values of the array are equal. True if both arrays are the same
107−length and the values are equal at every index.
108−
109− equals (fromList [2,2]) (repeat 2 2) == True
110− equals (fromList [1,2]) (repeat 2 2) == False
111−-}
112−equals : Array a -> Array a -> Bool
113−equals a b =
114− let go lists =
115− case lists of
116− (x::xs,y::ys) -> x == y && go (xs,ys)
117− ([],[]) -> True
118− _ -> False
119− in
120− go (Native.Array.toList a, Native.Array.toList b)
121−
122106{-| Push an element to the end of an array.
123107
124108 push 3 (fromList [1,2]) == fromList [1,2,3]
libraries/Dict.elm+2−14
@@ -1,5 +1,5 @@
11module Dict (empty,singleton,insert,update
2− ,lookup,findWithDefault,equals
2+ ,lookup,findWithDefault
33 ,remove,member
44 ,foldl,foldr,map
55 ,union,intersect,diff
@@ -17,7 +17,7 @@ Insert, remove, and query operations all take *O(log n)* time.
1717@docs empty, singleton, insert, update, remove
1818
1919# Query
20−@docs member, lookup, findWithDefault, equals
20+@docs member, lookup, findWithDefault
2121
2222# Combine
2323@docs union, intersect, diff
@@ -112,18 +112,6 @@ member : comparable -> Dict comparable v -> Bool
112112-- Does t contain k?
113113member k t = isJust <| lookup k t
114114
115−{-| Check if the contents of all keys and values are equal.
116−-}
117−equals : Dict comparable v -> Dict comparable v -> Bool
118−equals a b =
119− let go lists =
120− case lists of
121− (x::xs,y::ys) -> x == y && go (xs,ys)
122− ([],[]) -> True
123− _ -> False
124− in
125− go (toList a, toList b)
126−
127115ensureBlackRoot : Dict k v -> Dict k v
128116ensureBlackRoot t =
129117 case t of
libraries/Set.elm+2−7
@@ -1,6 +1,6 @@
11
22module Set (empty,singleton,insert,remove
3− ,member,equals
3+ ,member
44 ,foldl,foldr,map
55 ,union,intersect,diff
66 ,toList,fromList
@@ -16,7 +16,7 @@ Insert, remove, and query operations all take *O(log n)* time.
1616@docs empty, singleton, insert, remove
1717
1818# Query
19−@docs member, equals
19+@docs member
2020
2121# Combine
2222@docs union, intersect, diff
@@ -56,11 +56,6 @@ remove = Dict.remove
5656member : comparable -> Set comparable -> Bool
5757member = Dict.member
5858
59−{-| Check if the sets are the same size and all elements are equal.
60−-}
61−equals : Set comparable -> Set comparable -> Bool
62−equals = Dict.equals
63−
6459{-| Get the union of two sets. Keep all values. -}
6560union : Set comparable -> Set comparable -> Set comparable
6661union = Dict.union