Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / commons / oset.ml
index 064d8c4..aef78e7 100644 (file)
@@ -10,7 +10,7 @@ object(o: 'o)
   method virtual union: 'o -> 'o
   method virtual inter: 'o -> 'o
   method virtual minus: 'o -> 'o
-    
+
   (* allow binary methods tricks, generate exception when not good type *)
   method  tosetb: 'a Setb.t = raise Impossible
   method  tosetpt: SetPt.t = raise Impossible
@@ -18,21 +18,21 @@ object(o: 'o)
   method virtual toset: 'b. 'b (* generic (not safe) tricks *)
 
   (* is_intersect, equal, subset *)
-  method is_subset_of: 'o -> bool = fun o2 -> 
-    ((o2#minus o)#cardinal >= 0) && ((o#minus o2)#cardinal = 0)
+  method is_subset_of: 'o -> bool = fun o2 ->
+    ((o2#minus o)#cardinal >= 0) && ((o#minus o2)#cardinal =|= 0)
+
+  method is_equal: 'o -> bool = fun o2 ->
+    ((o2#minus o)#cardinal =|= 0) && ((o#minus o2)#cardinal =|= 0)
 
-  method is_equal: 'o -> bool = fun o2 -> 
-    ((o2#minus o)#cardinal = 0) && ((o#minus o2)#cardinal = 0)
-      
 
   method is_singleton: bool = (* can be short circuited *)
-    o#length = 1
+    o#length =|= 1
   method cardinal: int = (* just to keep naming conventions *)
-    o#length 
-      (* dont work: 
-         method big_union: 'b. ('a -> 'b oset) -> 'b oset = fun f -> todo() 
+    o#length
+      (* dont work:
+         method big_union: 'b. ('a -> 'b oset) -> 'b oset = fun f -> todo()
       *)
-      
+
 end
 
 let ($??$) e xs = xs#mem e
@@ -42,9 +42,9 @@ let ($--$) xs ys = xs#minus ys
 let ($<<=$) xs ys = xs#is_subset_of ys
 let ($==$) xs ys = xs#is_equal ys
 
-(* todo: pas beau le seed.  I dont put the type otherwise have to 
- * put explicit :> 
+(* todo: pas beau le seed.  I dont put the type otherwise have to
+ * put explicit :>
  *)
-let (mapo: ('a -> 'b) -> 'b oset -> 'a oset -> 'b oset) = fun f seed xs -> 
+let (mapo: ('a -> 'b) -> 'b oset -> 'a oset -> 'b oset) = fun f seed xs ->
   xs#fold (fun acc x -> acc#add (f x)) seed