[m-rev.] diff: sparse_bitset semidet functions

Zoltan Somogyi zs at csse.unimelb.edu.au
Thu Dec 14 16:53:33 AEDT 2006


library/sparse_bitset.m:
	Delete two semidet functions.

library/int.m:
	Fix some layout.

Zoltan.

cvs diff: Diffing .
Index: int.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.115
diff -u -b -r1.115 int.m
--- int.m	27 Sep 2006 07:39:51 -0000	1.115
+++ int.m	14 Dec 2006 05:49:48 -0000
@@ -219,20 +219,17 @@
 :- mode is(uo, di) is det.
 :- mode is(out, in) is det.
 
-    % int.max_int is the maximum value of an int
-    % on this machine.
+    % int.max_int is the maximum value of an int on this machine.
     %
 :- func int.max_int = int.
 :- pred int.max_int(int::out) is det.
 
-    % int.min_int is the minimum value of an int
-    % on this machine.
+    % int.min_int is the minimum value of an int on this machine.
     %
 :- func int.min_int = int.
 :- pred int.min_int(int::out) is det.
 
-    % int.bits_per_int is the number of bits in an int
-    % on this machine.
+    % int.bits_per_int is the number of bits in an int on this machine.
     %
 :- func int.bits_per_int = int.
 :- pred int.bits_per_int(int::out) is det.
Index: sparse_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.31
diff -u -b -r1.31 sparse_bitset.m
--- sparse_bitset.m	11 Dec 2006 06:41:53 -0000	1.31
+++ sparse_bitset.m	12 Dec 2006 11:45:05 -0000
@@ -161,23 +161,18 @@
 :- pred delete_list(sparse_bitset(T)::in, list(T)::in, sparse_bitset(T)::out)
     is det <= enum(T).
 
-    % `remove(Set, X)' returns the difference of `Set' and the set containing
-    % only `X', failing if `Set' does not contain `X'. Takes O(rep_size(Set))
-    % time and space.
+    % `remove(Set0, X, Set)' returns in `Set' the difference of `Set0'
+    % and the set containing only `X', failing if `Set0' does not contain `X'.
+    % Takes O(rep_size(Set)) time and space.
     %
-:- func remove(sparse_bitset(T)::in, T::in) = (sparse_bitset(T)::out)
-    is semidet <= enum(T).
 :- pred remove(sparse_bitset(T)::in, T::in, sparse_bitset(T)::out)
     is semidet <= enum(T).
 
-    % `remove_list(Set, X)' returns the difference of `Set' and the set
-    % containing all the elements of `X', failing if any element of `X'
-    % is not in `Set0'.
-    % Same as `subset(list_to_set(X), Set), difference(Set, list_to_set(X))',
-    % but may be more efficient.
+    % `remove_list(Set0, X, Set)' returns in `Set' the difference of `Set0'
+    % and the set containing all the elements of `X', failing if any element
+    % of `X' is not in `Set0'. Same as `subset(list_to_set(X), Set0),
+    % difference(Set0, list_to_set(X), Set)', but may be more efficient.
     %
-:- func remove_list(sparse_bitset(T)::in, list(T)::in) = (sparse_bitset(T)::out)
-    is semidet <= enum(T).
 :- pred remove_list(sparse_bitset(T)::in, list(T)::in, sparse_bitset(T)::out)
     is semidet <= enum(T).
 
@@ -190,7 +185,7 @@
     is det <= enum(T).
 
     % `remove_gt(Set, X)' returns `Set' with all elements greater than `X'
-    % removed. In other words, it returns the set containing % all the elements
+    % removed. In other words, it returns the set containing all the elements
     % of `Set' which are less than or equal to `X'.
     %
 :- func remove_gt(sparse_bitset(T), T) = sparse_bitset(T) <= enum(T).
@@ -459,7 +454,8 @@
     fold_bits(low_to_high, P, H ^ offset, H ^ bits, bits_per_int, !Acc),
     do_foldl_pred(P, T, !Acc).
 
-:- pred do_foldl2_pred(pred(T, U, U, V, V), bitset_impl, U, U, V, V) <= enum(T).
+:- pred do_foldl2_pred(pred(T, U, U, V, V), bitset_impl, U, U, V, V)
+    <= enum(T).
 :- mode do_foldl2_pred(pred(in, di, uo, di, uo) is det,
     in, di, uo, di, uo) is det.
 :- mode do_foldl2_pred(pred(in, in, out, di, uo) is det,
@@ -699,11 +695,11 @@
 delete(Set, Elem) = difference(Set, insert(init, Elem)).
 delete_list(Set, List) = difference(Set, list_to_set(List)).
 
-remove(Set0, Elem) = Set :-
+remove(Set0, Elem, Set) :-
     contains(Set0, Elem),
     Set = delete(Set0, Elem).
 
-remove_list(Set0, Elems) = Set :-
+remove_list(Set0, Elems, Set) :-
     list_to_set(Elems, ElemsSet),
     subset(ElemsSet, Set0),
     Set = difference(Set0, ElemsSet).
@@ -1139,10 +1135,6 @@
 
 delete_list(A, B, delete_list(A, B)).
 
-remove(A, B, remove(A, B)).
-
-remove_list(A, B, remove_list(A, B)).
-
 remove_leq(A, B, remove_leq(A, B)).
 
 remove_gt(A, B, remove_gt(A, B)).
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list