[m-rev.] diff/for review: clean up library modules (part 2)

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Jan 21 15:38:18 AEDT 2005


Index: library/map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.94
diff -u -r1.94 map.m
--- library/map.m	13 Jan 2005 11:04:37 -0000	1.94
+++ library/map.m	18 Jan 2005 11:44:34 -0000
@@ -31,34 +31,41 @@
 %-----------------------------------------------------------------------------%

 	% Initialize an empty map.
+	%
 :- pred map__init(map(_, _)::uo) is det.
 :- func map__init = (map(K, V)::uo) is det.

 	% Check whether a map is empty.
+	%
 :- pred map__is_empty(map(_, _)::in) is semidet.

 	% Check whether map contains key
+	%
 :- pred map__contains(map(K, _V)::in, K::in) is semidet.

 :- pred map__member(map(K, V)::in, K::out, V::out) is nondet.

 	% Search map for key.
+	%
 :- pred map__search(map(K, V)::in, K::in, V::out) is semidet.
 :- func map__search(map(K, V), K) = V is semidet.

 	% Search map for key, but abort if search fails.
+	%
 :- pred map__lookup(map(K, V)::in, K::in, V::out) is det.
 :- func map__lookup(map(K, V), K) = V.

 	% Search for a key-value pair using the key.  If there is no entry
 	% for the given key, returns the pair for the next lower key instead.
 	% Fails if there is no key with the given or lower value.
+	%
 :- pred map__lower_bound_search(map(K, V)::in, K::in, K::out, V::out)
 	is semidet.

 	% Search for a key-value pair using the key.  If there is no entry
 	% for the given key, returns the pair for the next lower key instead.
 	% Aborts if there is no key with the given or lower value.
+	%
 :- pred map__lower_bound_lookup(map(K, V)::in, K::in, K::out, V::out) is det.

 	% Search for a key-value pair using the key.  If there is no entry
@@ -116,11 +123,13 @@

 	% Update the value corresponding to a given key
 	% Fail if the key doesn't already exist.
+	%
 :- pred map__update(map(K, V)::in, K::in, V::in, map(K, V)::out) is semidet.
 :- func map__update(map(K, V), K, V) = map(K, V) is semidet.

 	% Update the value corresponding to a given key
 	% Abort if the key doesn't already exist.
+	%
 :- pred map__det_update(map(K, V)::in, K::in, V::in, map(K, V)::out) is det.
 :- func map__det_update(map(K, V), K, V) = map(K, V).

@@ -140,133 +149,146 @@

 	% Update value if the key is already present, otherwise
 	% insert new key and value.
-:- pred map__set(map(K, V), K, V, map(K, V)).
-:- mode map__set(di, di, di, uo) is det.
-:- mode map__set(in, in, in, out) is det.
-
+	%
 :- func map__set(map(K, V), K, V) = map(K, V).
+:- pred map__set(map(K, V)::in, K::in, V::in, map(K, V)::out) is det.

 	% Given a map, return a list of all the keys in the map.
-:- pred map__keys(map(K, _V)::in, list(K)::out) is det.
+	%
 :- func map__keys(map(K, _V)) = list(K).
+:- pred map__keys(map(K, _V)::in, list(K)::out) is det.

 	% Given a map, return a list of all the keys in the map,
 	% in sorted order.
-:- pred map__sorted_keys(map(K, _V)::in, list(K)::out) is det.
+	%
 :- func map__sorted_keys(map(K, _V)) = list(K).
+:- pred map__sorted_keys(map(K, _V)::in, list(K)::out) is det.

 	% Given a map, return a list of all the data values in the map.
-:- pred map__values(map(_K, V)::in, list(V)::out) is det.
+	%
 :- func map__values(map(_K, V)) = list(V).
+:- pred map__values(map(_K, V)::in, list(V)::out) is det.

 	% Convert a map to an association list.
-:- pred map__to_assoc_list(map(K, V)::in, assoc_list(K, V)::out) is det.
+	%
 :- func map__to_assoc_list(map(K, V)) = assoc_list(K, V).
+:- pred map__to_assoc_list(map(K, V)::in, assoc_list(K, V)::out) is det.

 	% Convert a map to an association list which is sorted on the keys.
-:- pred map__to_sorted_assoc_list(map(K, V)::in, assoc_list(K, V)::out) is det.
+	%
 :- func map__to_sorted_assoc_list(map(K, V)) = assoc_list(K, V).
+:- pred map__to_sorted_assoc_list(map(K, V)::in, assoc_list(K, V)::out) is det.

 	% Convert an association list to a map.
-:- pred map__from_assoc_list(assoc_list(K, V)::in, map(K, V)::out) is det.
+	%
 :- func map__from_assoc_list(assoc_list(K, V)) = map(K, V).
+:- pred map__from_assoc_list(assoc_list(K, V)::in, map(K, V)::out) is det.

 	% Convert a sorted association list to a map.
+	%
+:- func map__from_sorted_assoc_list(assoc_list(K, V)) = map(K, V).
 :- pred map__from_sorted_assoc_list(assoc_list(K, V)::in, map(K, V)::out)
 	is det.
-:- func map__from_sorted_assoc_list(assoc_list(K, V)) = map(K, V).

 	% Delete a key-value pair from a map.
 	% If the key is not present, leave the map unchanged.
-:- pred map__delete(map(K, V), K, map(K, V)).
-:- mode map__delete(di, in, uo) is det.
-:- mode map__delete(in, in, out) is det.
-
+	%
 :- func map__delete(map(K, V), K) = map(K, V).
+:- pred map__delete(map(K, V)::in, K::in, map(K, V)::out) is det.

 	% Apply map__delete/3 to a list of keys.
-:- pred map__delete_list(map(K, V), list(K), map(K, V)).
-:- mode map__delete_list(di, in, uo) is det.
-:- mode map__delete_list(in, in, out) is det.
-
+	%
 :- func map__delete_list(map(K, V), list(K)) = map(K, V).
+:- pred map__delete_list(map(K, V)::in, list(K)::in, map(K, V)::out) is det.

 	% Delete a key-value pair from a map and return the value.
 	% Fail if the key is not present.
+	%
 :- pred map__remove(map(K, V)::in, K::in, V::out, map(K, V)::out) is semidet.

 	% Delete a key-value pair from a map and return the value.
 	% Abort if the key is not present.
+	%
 :- pred map__det_remove(map(K, V)::in, K::in, V::out, map(K, V)::out) is det.

 	% Count the number of elements in the map.
-:- pred map__count(map(K, V)::in, int::out) is det.
+	%
 :- func map__count(map(K, V)) = int.
+:- pred map__count(map(K, V)::in, int::out) is det.

 	% Convert a pair of lists (which must be of the same length)
 	% to a map.
+	%
+:- func map__from_corresponding_lists(list(K), list(V)) = map(K, V).
 :- pred map__from_corresponding_lists(list(K)::in, list(V)::in, map(K, V)::out)
 	is det.
-:- func map__from_corresponding_lists(list(K), list(V)) = map(K, V).

 	% For map__merge(MapA, MapB, Map), MapA and MapB must
 	% not both contain the same key.
-:- pred map__merge(map(K, V)::in, map(K, V)::in, map(K, V)::out) is det.
+	%
 :- func map__merge(map(K, V), map(K, V)) = map(K, V).
+:- pred map__merge(map(K, V)::in, map(K, V)::in, map(K, V)::out) is det.

 	% For map__overlay(MapA, MapB, Map), if MapA and MapB both
 	% contain the same key, then Map will map that key to
 	% the value from MapB.  In otherwords, MapB takes precedence
 	% over MapA.
-:- pred map__overlay(map(K, V)::in, map(K, V)::in, map(K, V)::out) is det.
+	%
 :- func map__overlay(map(K, V), map(K, V)) = map(K, V).
+:- pred map__overlay(map(K, V)::in, map(K, V)::in, map(K, V)::out) is det.

 	% map__overlay_large_map(MapA, MapB, Map) performs the same task as
 	% map__overlay(MapA, MapB, Map). However, while map__overlay takes time
 	% proportional to the size of MapB, map__overlay_large_map takes time
 	% proportional to the size of MapA. In other words, it preferable when
 	% MapB is a large map.
+	%
+:- func map__overlay_large_map(map(K, V), map(K, V)) = map(K, V).
 :- pred map__overlay_large_map(map(K, V)::in, map(K, V)::in, map(K, V)::out)
 	is det.
-:- func map__overlay_large_map(map(K, V), map(K, V)) = map(K, V).

 	% map__select takes a map and a set of keys and returns
 	% a map containing the keys in the set and their corresponding
 	% values.
-:- pred map__select(map(K, V)::in, set(K)::in, map(K, V)::out) is det.
+	%
 :- func map__select(map(K, V), set(K)) = map(K, V).
+:- pred map__select(map(K, V)::in, set(K)::in, map(K, V)::out) is det.

 	% Given a list of keys, produce a list of their corresponding
 	% values in a specified map.
-:- pred map__apply_to_list(list(K)::in, map(K, V)::in, list(V)::out) is det.
+	%
 :- func map__apply_to_list(list(K), map(K, V)) = list(V).
+:- pred map__apply_to_list(list(K)::in, map(K, V)::in, list(V)::out) is det.

 	% Declaratively, a NOP.
 	% Operationally, a suggestion that the implementation
 	% optimize the representation of the map in the expectation
 	% of a number of lookups but few or no modifications.
-:- pred map__optimize(map(K, V)::in, map(K, V)::out) is det.
+	%
 :- func map__optimize(map(K, V)) = map(K, V).
+:- pred map__optimize(map(K, V)::in, map(K, V)::out) is det.

 	% Remove the smallest item from the map, fail if
 	% the map is empty.
+	%
 :- pred map__remove_smallest(map(K, V)::in, K::out, V::out, map(K, V)::out)
 	is semidet.

 	% Perform an inorder traversal of the map, applying
 	% an accumulator predicate for each key-value pair.
+	%
+:- func map__foldl(func(K, V, T) = T, map(K, V), T) = T.
 :- pred map__foldl(pred(K, V, T, T), map(K, V), T, T).
 :- mode map__foldl(pred(in, in, in, out) is det, in, in, out) is det.
 :- mode map__foldl(pred(in, in, in, out) is semidet, in, in, out) is semidet.
 :- mode map__foldl(pred(in, in, di, uo) is det, in, di, uo) is det.

-:- func map__foldl(func(K, V, T) = T, map(K, V), T) = T.
-
 	% Perform an inorder traversal of the map, applying
 	% an accumulator predicate with two accumulators for
 	% each key-value pair.
 	% (Although no more expressive than map__foldl, this is often
 	% a more convenient format, and a little more efficient).
+	%
 :- pred map__foldl2(pred(K, V, T, T, U, U), map(K, V), T, T, U, U).
 :- mode map__foldl2(pred(in, in, in, out, in, out) is det,
 	in, in, out, in, out) is det.
@@ -282,6 +304,7 @@
 	% each key-value pair.
 	% (Although no more expressive than map__foldl, this is often
 	% a more convenient format, and a little more efficient).
+	%
 :- pred map__foldl3(pred(K, V, T, T, U, U, W, W), map(K, V), T, T, U, U, W, W).
 :- mode map__foldl3(pred(in, in, in, out, in, out, in, out) is det,
 	in, in, out, in, out, in, out) is det.
@@ -296,14 +319,15 @@

 	% Apply a transformation predicate to all the values
 	% in a map.
+	%
+:- func map__map_values(func(K, V) = W, map(K, V)) = map(K, W).
 :- pred map__map_values(pred(K, V, W), map(K, V), map(K, W)).
 :- mode map__map_values(pred(in, in, out) is det, in, out) is det.
 :- mode map__map_values(pred(in, in, out) is semidet, in, out) is semidet.

-:- func map__map_values(func(K, V) = W, map(K, V)) = map(K, W).
-
 	% Apply a transformation predicate to all the values
 	% in a map, while continuously updating an accumulator.
+	%
 :- pred map__map_foldl(pred(K, V, W, A, A), map(K, V), map(K, W), A, A).
 :- mode map__map_foldl(pred(in, in, out, di, uo) is det, in, out, di, uo)
 	is det.
@@ -313,6 +337,7 @@
 	is semidet.

 	% As map__map_foldl, but with two accumulators.
+	%
 :- pred map__map_foldl2(pred(K, V, W, A, A, B, B), map(K, V), map(K, W),
 	A, A, B, B).
 :- mode map__map_foldl2(pred(in, in, out, in, out, in, out) is det,
@@ -326,6 +351,7 @@
 	% predicate to the values associated with the key in M1 and M2.
 	% Fail if and only if this predicate fails on the values associated
 	% with some common key.
+	%
 :- pred map__intersect(pred(V, V, V), map(K, V), map(K, V), map(K, V)).
 :- mode map__intersect(pred(in, in, out) is semidet, in, in, out) is semidet.
 :- mode map__intersect(pred(in, in, out) is det, in, in, out) is det.
@@ -333,6 +359,7 @@
 :- func map__intersect(func(V, V) = V, map(K, V), map(K, V)) = map(K, V).

 	% Calls map__intersect. Aborts if map__intersect fails.
+	%
 :- pred map__det_intersect(pred(V, V, V), map(K, V), map(K, V), map(K, V)).
 :- mode map__det_intersect(pred(in, in, out) is semidet, in, in, out) is det.

@@ -352,6 +379,7 @@
 	% map__common_subset is very similar to map__intersect, but can succeed
 	% even with an output map that does not contain an entry for a key
 	% value that occurs in both input maps.
+	%
 :- func map__common_subset(map(K, V), map(K, V)) = map(K, V).

 	% Given two maps M1 and M2, create a third map M3 that all the keys
@@ -360,13 +388,14 @@
 	% predicate to the values associated with the key in M1 and M2.
 	% Fail if and only if this predicate fails on the values associated
 	% with some common key.
+	%
+:- func map__union(func(V, V) = V, map(K, V), map(K, V)) = map(K, V).
 :- pred map__union(pred(V, V, V), map(K, V), map(K, V), map(K, V)).
 :- mode map__union(pred(in, in, out) is semidet, in, in, out) is semidet.
 :- mode map__union(pred(in, in, out) is det, in, in, out) is det.

-:- func map__union(func(V, V) = V, map(K, V), map(K, V)) = map(K, V).
-
 	% Calls map__union. Aborts if map__union fails.
+	%
 :- pred map__det_union(pred(V, V, V), map(K, V), map(K, V), map(K, V)).
 :- mode map__det_union(pred(in, in, out) is semidet, in, in, out) is det.

@@ -376,25 +405,31 @@
 	% Consider the original map a set of key-value pairs. This predicate
 	% returns a map that maps each value to the set of keys it is paired
 	% with in the original map.
+	%
 :- func map__reverse_map(map(K, V)) = map(V, set(K)).

 	% Field selection for maps.

 	% Map ^ elem(Key) = map__search(Map, Key).
+	%
 :- func map__elem(K, map(K, V)) = V is semidet.

 	% Map ^ det_elem(Key) = map__lookup(Map, Key).
+	%
 :- func map__det_elem(K, map(K, V)) = V.

 	% Field update for maps.

 	% (Map ^ elem(Key) := Value) = map__set(Map, Key, Value).
+	%
 :- func 'map__elem :='(K, map(K, V), V) = map(K, V).

 	% (Map ^ det_elem(Key) := Value) = map__det_update(Map, Key, Value).
+	%
 :- func 'map__det_elem :='(K, map(K, V), V) = map(K, V).

 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

 :- implementation.

Index: library/multi_map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/multi_map.m,v
retrieving revision 1.13
diff -u -r1.13 multi_map.m
--- library/multi_map.m	5 Apr 2004 05:08:52 -0000	1.13
+++ library/multi_map.m	19 Jan 2005 04:51:31 -0000
@@ -30,176 +30,210 @@
 %-----------------------------------------------------------------------------%

 	% Initialize an empty multi_map.
-:- pred multi_map__init(multi_map(_, _)::uo) is det.
+	%
 :- func multi_map__init = multi_map(_, _).
+:- pred multi_map__init(multi_map(_, _)::uo) is det.

 	% Check whether a multi_map is empty.
+	%
 :- pred multi_map__is_empty(multi_map(_, _)::in) is semidet.

-	% Check whether multi_map contains key
+	% Check whether multi_map contains key.
+	%
 :- pred multi_map__contains(multi_map(K, _V)::in, K::in) is semidet.

 :- pred multi_map__member(multi_map(K, V)::in, K::out, V::out) is nondet.

 	% Search multi_map for given key.
+	%
 :- pred multi_map__search(multi_map(K, V)::in, K::in, list(V)::out) is semidet.

 	% Search multi_map for given key.
+	%
 :- pred multi_map__nondet_search(multi_map(K, V)::in, K::in, V::out) is nondet.

 	% Search multi_map for key, but abort if search fails.
-:- pred multi_map__lookup(multi_map(K, V)::in, K::in, list(V)::out) is det.
+	%
 :- func multi_map__lookup(multi_map(K, V), K) = list(V).
+:- pred multi_map__lookup(multi_map(K, V)::in, K::in, list(V)::out) is det.

 	% Search multi_map for key.
+	%
 :- pred multi_map__nondet_lookup(multi_map(K, V)::in, K::in, V::out) is nondet.

 	% Search multi_map for data.
+	%
 :- pred multi_map__inverse_search(multi_map(K, V)::in, V::in, K::out) is nondet.

 	% Insert a new key and corresponding value into a multi_map.
 	% Fail if the key already exists.
+	%
 :- pred multi_map__insert(multi_map(K, V)::in, K::in, V::in,
 	multi_map(K, V)::out) is semidet.

 	% Insert a new key and corresponding value into a multi_map.
 	% Abort if the key already exists.
+	%
+:- func multi_map__det_insert(multi_map(K, V), K, V) = multi_map(K, V).
 :- pred multi_map__det_insert(multi_map(K, V)::in, K::in, V::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__det_insert(multi_map(K, V), K, V) = multi_map(K, V).

 	% Update (add) the value corresponding to a given key
 	% Fail if the key doesn't already exist.
+	%
 :- pred multi_map__update(multi_map(K, V)::in, K::in, V::in,
 	multi_map(K, V)::out) is semidet.

 	% Update (add) the value corresponding to a given key
 	% Abort if the key doesn't already exist.
+	%
+:- func multi_map__det_update(multi_map(K, V), K, V) = multi_map(K, V).
 :- pred multi_map__det_update(multi_map(K, V)::in, K::in, V::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__det_update(multi_map(K, V), K, V) = multi_map(K, V).

 	% Update (replace) the value corresponding to a given key
 	% Abort if the key doesn't already exist.
+	%
+:- func multi_map__det_replace(multi_map(K, V), K, list(V)) = multi_map(K, V).
 :- pred multi_map__det_replace(multi_map(K, V)::in, K::in, list(V)::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__det_replace(multi_map(K, V), K, list(V)) = multi_map(K, V).

 	% Update (add) value if the key is already present, otherwise
 	% insert new key and value.
+	%
+:- func multi_map__set(multi_map(K, V), K, V) = multi_map(K, V).
 :- pred multi_map__set(multi_map(K, V)::in, K::in, V::in, multi_map(K, V)::out)
 	is det.
-:- func multi_map__set(multi_map(K, V), K, V) = multi_map(K, V).

 	% Given a multi_map, return a list of all the keys in the multi_map
-:- pred multi_map__keys(multi_map(K, _V)::in, list(K)::out) is det.
+	%
 :- func multi_map__keys(multi_map(K, _V)) = list(K).
+:- pred multi_map__keys(multi_map(K, _V)::in, list(K)::out) is det.

 	% Given a multi_map, return a list of all the data values in the
 	% multi_map
-:- pred multi_map__values(multi_map(_K, V)::in, list(V)::out) is det.
+	%
 :- func multi_map__values(multi_map(_K, V)) = list(V).
+:- pred multi_map__values(multi_map(_K, V)::in, list(V)::out) is det.

-	% convert a multi_map to an association list
+	% Convert a multi_map to an association list.
+	%
+:- func multi_map__to_flat_assoc_list(multi_map(K, V)) = assoc_list(K, V).
 :- pred multi_map__to_flat_assoc_list(multi_map(K, V)::in,
 	assoc_list(K, V)::out) is det.
-:- func multi_map__to_flat_assoc_list(multi_map(K, V)) = assoc_list(K, V).

-	% convert an association list to a multi_map
+	% Convert an association list to a multi_map.
+	%
+:- func multi_map__from_flat_assoc_list(assoc_list(K, V)) = multi_map(K, V).
 :- pred multi_map__from_flat_assoc_list(assoc_list(K, V)::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__from_flat_assoc_list(assoc_list(K, V)) = multi_map(K, V).

-	% convert a multi_map to an association list, with all the
+	% Convert a multi_map to an association list, with all the
 	% values for each key in one element of the association list.
+	%
+:- func multi_map__to_assoc_list(multi_map(K, V)) = assoc_list(K, list(V)).
 :- pred multi_map__to_assoc_list(multi_map(K, V)::in,
 	assoc_list(K, list(V))::out) is det.
-:- func multi_map__to_assoc_list(multi_map(K, V)) = assoc_list(K, list(V)).

-	% convert an association list with all the values for each
-	% key in one element of the list to a multi_map
+	% Convert an association list with all the values for each
+	% key in one element of the list to a multi_map.
+	%
+:- func multi_map__from_assoc_list(assoc_list(K, list(V))) = multi_map(K, V).
 :- pred multi_map__from_assoc_list(assoc_list(K, list(V))::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__from_assoc_list(assoc_list(K, list(V))) = multi_map(K, V).

-	% convert a sorted association list to a multi_map
-:- pred multi_map__from_sorted_assoc_list(assoc_list(K, list(V))::in,
-	multi_map(K, V)::out) is det.
+	% Convert a sorted association list to a multi_map.
+	%
 :- func multi_map__from_sorted_assoc_list(assoc_list(K, list(V)))
 	= multi_map(K, V).
+:- pred multi_map__from_sorted_assoc_list(assoc_list(K, list(V))::in,
+	multi_map(K, V)::out) is det.

-	% delete a key and data from a multi_map
-	% if the key is not present, leave the multi_map unchanged
+	% Delete a key and data from a multi_map
+	% if the key is not present, leave the multi_map unchanged.
+	%
+:- func multi_map__delete(multi_map(K, V), K) = multi_map(K, V).
 :- pred multi_map__delete(multi_map(K, V)::in, K::in, multi_map(K, V)::out)
 	is det.
-:- func multi_map__delete(multi_map(K, V), K) = multi_map(K, V).

-	% delete a data value from a key in a multi_map
-	% if the key is not present, leave the multi_map unchanged
+	% Delete a data value from a key in a multi_map
+	% if the key is not present, leave the multi_map unchanged.
+	%
+:- func multi_map__delete(multi_map(K, V), K, V) = multi_map(K, V).
 :- pred multi_map__delete(multi_map(K, V)::in, K::in, V::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__delete(multi_map(K, V), K, V) = multi_map(K, V).

-	% delete a key-value pair from a multi_map and return the value.
-	% fail if the key is not present
+	% Delete a key-value pair from a multi_map and return the value.
+	% fail if the key is not present.
+	%
 :- pred multi_map__remove(multi_map(K, V)::in, K::in, list(V)::out,
 	multi_map(K, V)::out) is semidet.

-	% delete a key-value pair from a multi_map and return the value.
-	% abort if the key is not present
+	% Delete a key-value pair from a multi_map and return the value.
+	% abort if the key is not present.
+	%
 :- pred multi_map__det_remove(multi_map(K, V)::in, K::in, list(V)::out,
 	multi_map(K, V)::out) is det.

 	% Count the number of elements (keys) in the multi_map.
-:- pred multi_map__count(multi_map(K, V)::in, int::out) is det.
+	%
 :- func multi_map__count(multi_map(K, V)) = int.
+:- pred multi_map__count(multi_map(K, V)::in, int::out) is det.

 	% Count the number of data elements in the multi_map.
-:- pred multi_map__all_count(multi_map(K, V)::in, int::out) is det.
+	%
 :- func multi_map__all_count(multi_map(K, V)) = int.
+:- pred multi_map__all_count(multi_map(K, V)::in, int::out) is det.

 	% Convert a pair of lists (which must be of the same length)
 	% to a multi_map.
-:- pred multi_map__from_corresponding_lists(list(K)::in, list(V)::in,
-	multi_map(K, V)::out) is det.
+	%
 :- func multi_map__from_corresponding_lists(list(K), list(V))
 	= multi_map(K, V).
+:- pred multi_map__from_corresponding_lists(list(K)::in, list(V)::in,
+	multi_map(K, V)::out) is det.

 	% Convert a pair of lists (which must be of the same length)
 	% to a multi_map.
-:- pred multi_map__from_corresponding_list_lists(list(K)::in, list(list(V))::in,
-	multi_map(K, V)::out) is det.
+	%
 :- func multi_map__from_corresponding_list_lists(list(K), list(list(V)))
 	= multi_map(K, V).
-
-	% For multi_map__merge(MultiMapA, MultiMapB, MultiMap).
-:- pred multi_map__merge(multi_map(K, V)::in, multi_map(K, V)::in,
+:- pred multi_map__from_corresponding_list_lists(list(K)::in, list(list(V))::in,
 	multi_map(K, V)::out) is det.
+
+	% For multi_map__merge(MultiMapA, MultiMapB, MultiMap).
+	%
 :- func multi_map__merge(multi_map(K, V), multi_map(K, V))
 	= multi_map(K, V).
+:- pred multi_map__merge(multi_map(K, V)::in, multi_map(K, V)::in,
+	multi_map(K, V)::out) is det.

 	% multi_map__select takes a multi_map and a set of keys and returns
 	% a multi_map containing the keys in the set and their corresponding
 	% values.
+	%
+:- func multi_map__select(multi_map(K, V), set(K)) = multi_map(K, V).
 :- pred multi_map__select(multi_map(K, V)::in, set(K)::in,
 	multi_map(K, V)::out) is det.
-:- func multi_map__select(multi_map(K, V), set(K)) = multi_map(K, V).

 	% Given a list of keys, produce a list of their values in a
 	% specified multi_map.
+	%
+:- func multi_map__apply_to_list(list(K), multi_map(K, V)) = list(V).
 :- pred multi_map__apply_to_list(list(K)::in, multi_map(K, V)::in,
 	list(V)::out) is det.
-:- func multi_map__apply_to_list(list(K), multi_map(K, V)) = list(V).

 	% Declaratively, a NOP.
 	% Operationally, a suggestion that the implemention
 	% optimize the representation of the multi_map in the expectation
 	% of a number of lookups but few or no modifications.
-:- pred multi_map__optimize(multi_map(K, V)::in, multi_map(K, V)::out) is det.
+	%
 :- func multi_map__optimize(multi_map(K, V)) = multi_map(K, V).
+:- pred multi_map__optimize(multi_map(K, V)::in, multi_map(K, V)::out) is det.

 	% Remove the smallest item from the multi_map, fail if
 	% the multi_map is empty.
+	%
 :- pred multi_map__remove_smallest(multi_map(K, V)::in, K::out, list(V)::out,
 	multi_map(K, V)::out) is semidet.

Index: library/pqueue.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/pqueue.m,v
retrieving revision 1.16
diff -u -r1.16 pqueue.m
--- library/pqueue.m	18 Jan 2005 08:09:03 -0000	1.16
+++ library/pqueue.m	18 Jan 2005 10:26:31 -0000
@@ -29,27 +29,32 @@
 :- type pqueue(_K, _V).

 	% Create an empty priority queue
+	%
 :- pred pqueue__init(pqueue(_K, _V)::out) is det.
 :- func pqueue__init = pqueue(_K, _V).

 	% Insert a value V with key K into a priority queue
 	% and return the new priority queue.
+	%
 :- pred pqueue__insert(pqueue(K, V)::in, K::in, V::in, pqueue(K, V)::out)
 	is det.
 :- func pqueue__insert(pqueue(K, V), K, V) = pqueue(K, V).

 	% Remove the smallest item from the priority queue.
+	%
 :- pred pqueue__remove(pqueue(K, V)::in, K::out, V::out, pqueue(K, V)::out)
 	is semidet.

 	% Extract all the items from a priority queue by
 	% repeated removal, and place them in an association
 	% list.
+	%
 :- pred pqueue__to_assoc_list(pqueue(K, V)::in, assoc_list(K, V)::out) is det.
 :- func pqueue__to_assoc_list(pqueue(K, V)) = assoc_list(K, V).

 	% Insert all the key-value pairs in an association list
 	% into a priority queue.
+	%
 :- pred pqueue__assoc_list_to_pqueue(assoc_list(K, V)::in, pqueue(K, V)::out)
 	is det.
 :- func pqueue__assoc_list_to_pqueue(assoc_list(K, V)) = pqueue(K, V).
@@ -59,6 +64,7 @@
 :- func pqueue__from_assoc_list(assoc_list(K, V)) = pqueue(K, V).

 %---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------%

 :- implementation.

Index: library/queue.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/queue.m,v
retrieving revision 1.24
diff -u -r1.24 queue.m
--- library/queue.m	15 Mar 2004 23:49:34 -0000	1.24
+++ library/queue.m	18 Jan 2005 10:27:28 -0000
@@ -25,72 +25,74 @@
 :- type queue(T).

 	% `queue__init(Queue)' is true iff `Queue' is an empty queue.
-
+	%
 :- pred queue__init(queue(T)::out) is det.
 :- func queue__init = queue(T).

 	% 'queue_equal(Q1, Q2)' is true iff Q1 and Q2 contain the same
 	% elements in the same order.
-
+	%
 :- pred queue__equal(queue(T)::in, queue(T)::in) is semidet.

 	% `queue__is_empty(Queue)' is true iff `Queue' is an empty queue.
-
+	%
 :- pred queue__is_empty(queue(T)::in) is semidet.

 	% `queue__is_full(Queue)' is intended to be true iff `Queue'
 	% is a queue whose capacity is exhausted.  This
 	% implementation allows arbitrary-sized queues, so queue__is_full
 	% always fails.
-
+	%
 :- pred queue__is_full(queue(T)::in) is semidet.

 	% `queue__put(Queue0, Elem, Queue)' is true iff `Queue' is
 	% the queue which results from appending `Elem' onto the end
 	% of `Queue0'.
-
+	%
 :- pred queue__put(queue(T)::in, T::in, queue(T)::out) is det.
 :- func queue__put(queue(T), T) = queue(T).

 	% `queue__put_list(Queue0, Elems, Queue)' is true iff `Queue'
 	% is the queue which results from inserting the items in the
 	% list `Elems' into `Queue0'.
-
+	%
 :- pred queue__put_list(queue(T)::in, list(T)::in, queue(T)::out) is det.
 :- func queue__put_list(queue(T), list(T)) = queue(T).

 	% `queue__first(Queue, Elem)' is true iff `Queue' is a non-empty
 	% queue whose first element is `Elem'.
-
+	%
 :- pred queue__first(queue(T)::in, T::out) is semidet.

 	% `queue__get(Queue0, Elem, Queue)' is true iff `Queue0' is
 	% a non-empty queue whose first element is `Elem', and `Queue'
 	% the queue which results from removing that element from
 	% the front of `Queue0'.
-
+	%
 :- pred queue__get(queue(T)::in, T::out, queue(T)::out) is semidet.

 	% `queue__length(Queue, Length)' is true iff `Queue' is a queue
 	% containing `Length' elements.
-
+	%
 :- pred queue__length(queue(T)::in, int::out) is det.
 :- func queue__length(queue(T)) = int.

 	% `queue__list_to_queue(List, Queue)' is true iff `Queue' is a queue
 	% containing the elements of List, with the first element of List at
 	% the head of the queue.
-
+	%
 :- pred queue__list_to_queue(list(T)::in, queue(T)::out) is det.
 :- func queue__list_to_queue(list(T)) = queue(T).

 	% `queue__delete_all(Queue0, Elem, Queue)' is true iff `Queue' is
 	% the same queue as `Queue0' with all occurences of `Elem' removed
 	% from it.
+	%
 :- pred queue__delete_all(queue(T)::in, T::in, queue(T)::out) is det.
 :- func queue__delete_all(queue(T), T) = queue(T).

 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%

 :- implementation.

Index: library/random.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/random.m,v
retrieving revision 1.23
diff -u -r1.23 random.m
--- library/random.m	15 Mar 2004 06:50:16 -0000	1.23
+++ library/random.m	18 Jan 2005 11:32:17 -0000
@@ -56,6 +56,7 @@

 	% random__init(Seed, RS): creates a supply of random numbers RS
 	% using the specified Seed.
+	%
 :- pred random__init(int::in, random__supply::uo) is det.

 	% random__random(Num, RS0, RS): extracts a number Num in the
@@ -70,6 +71,7 @@
 	% supply RS0, and binds RS to the new state of the random number
 	% supply.  For best results, the value of Range should be no greater
 	% than about 100.
+	%
 :- pred random__random(int, int, int, random__supply, random__supply).
 :- mode random__random(in, in, out, mdi, muo) is det.
 :- mode random__random(in, in, out, in, out) is det.
@@ -77,6 +79,7 @@
 	% random__randmax(RandMax, RS0, RS): binds RandMax to the maximum
 	% random number that can be returned from the random number
 	% supply RS0, and returns RS = RS0.
+	%
 :- pred random__randmax(int, random__supply, random__supply).
 :- mode random__randmax(out, mdi, muo) is det.
 :- mode random__randmax(out, in, out) is det.
@@ -85,6 +88,7 @@
 	% number of distinct random numbers that can be returned from the
 	% random number supply RS0, and returns RS = RS0.  This will be one
 	% more than the number returned by randmax/3.
+	%
 :- pred random__randcount(int, random__supply, random__supply).
 :- mode random__randcount(out, mdi, muo) is det.
 :- mode random__randcount(out, in, out) is det.
@@ -92,11 +96,13 @@
 	% random__permutation(List0, List, RS0, RS):
 	% binds List to a random permutation of List0,
 	% and binds RS to the new state of the random number supply.
+	%
 :- pred random__permutation(list(T), list(T), random__supply, random__supply).
 :- mode random__permutation(in, out, mdi, muo) is det.
 :- mode random__permutation(in, out, in, out) is det.

 %---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------%

 :- implementation.
 	% Everything after the first `:- implementation' does not appear
Index: library/rbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rbtree.m,v
retrieving revision 1.18
diff -u -r1.18 rbtree.m
--- library/rbtree.m	13 Jan 2005 11:04:37 -0000	1.18
+++ library/rbtree.m	18 Jan 2005 13:07:59 -0000
@@ -76,9 +76,7 @@
 	% Sets a value regardless of whether key exists or not.
 	%
 :- func rbtree__set(rbtree(K, V), K, V) = rbtree(K, V).
-:- pred rbtree__set(rbtree(K, V), K, V, rbtree(K, V)).
-:- mode rbtree__set(di, di, di, uo) is det.
-:- mode rbtree__set(in, in, in, out) is det.
+:- pred rbtree__set(rbtree(K, V)::in, K::in, V::in, rbtree(K, V)::out) is det.

 	% Insert a duplicate key into the tree.
 	%
@@ -131,16 +129,13 @@
 	% Does nothing if the key does not exist.
 	%
 :- func rbtree__delete(rbtree(K, V), K) = rbtree(K, V).
-:- pred rbtree__delete(rbtree(K, V), K, rbtree(K, V)).
-:- mode rbtree__delete(di, in, uo) is det.
-:- mode rbtree__delete(in, in, out) is det.
+:- pred rbtree__delete(rbtree(K, V)::in, K::in, rbtree(K, V)::out) is det.

 	% Remove the key-value pair associated with a key.
 	% Fails if the key does not exist.
 	%
-:- pred rbtree__remove(rbtree(K, V), K, V, rbtree(K, V)).
-:- mode rbtree__remove(di, in, uo, uo) is semidet.
-:- mode rbtree__remove(in, in, out, out) is semidet.
+:- pred rbtree__remove(rbtree(K, V)::in, K::in, V::out,
+	rbtree(K, V)::out) is semidet.

 	% Same as above, except this version does not return the value
 	% corresponding to the key.  Its use is deprecated, but it is
@@ -152,16 +147,14 @@
 	% Deletes the node with the minimum key from the tree,
 	% and returns the key and value fields.
 	%
-:- pred rbtree__remove_smallest(rbtree(K, V), K, V, rbtree(K, V)).
-:- mode rbtree__remove_smallest(di, uo, uo, uo) is semidet.
-:- mode rbtree__remove_smallest(in, out, out, out) is semidet.
+:- pred rbtree__remove_smallest(rbtree(K, V)::in, K::out, V::out,
+	rbtree(K, V)::out) is semidet.

 	% Deletes the node with the maximum key from the tree,
 	% and returns the key and value fields.
 	%
-:- pred rbtree__remove_largest(rbtree(K, V), K, V, rbtree(K, V)).
-:- mode rbtree__remove_largest(di, uo, uo, uo) is semidet.
-:- mode rbtree__remove_largest(in, out, out, out) is semidet.
+:- pred rbtree__remove_largest(rbtree(K, V)::in, K::out, V::out,
+	rbtree(K, V)::out) is semidet.

 	% Returns an in-order list of all the keys in the rbtree.
 	%
@@ -865,8 +858,6 @@
 %	Algorithm O(log N).

 :- pred rbtree__delete_2(rbtree(K, V), K, bool, maybe(V), rbtree(K, V)).
-:- mode rbtree__delete_2(di, in, in, uo, uo) is semidet.
-:- mode rbtree__delete_2(di, in, in(bound(no)), uo, uo) is det.
 :- mode rbtree__delete_2(in, in, in, out, out) is semidet.
 :- mode rbtree__delete_2(in, in, in(bound(no)), out, out) is det.

Index: library/set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set.m,v
retrieving revision 1.65
diff -u -r1.65 set.m
--- library/set.m	18 Jan 2005 04:27:17 -0000	1.65
+++ library/set.m	19 Jan 2005 05:08:04 -0000
@@ -22,7 +22,7 @@

 	% `set__list_to_set(List, Set)' is true iff `Set' is the set
 	% containing only the members of `List'.
-
+	%
 :- pred set__list_to_set(list(T)::in, set(T)::out) is det.
 :- func set__list_to_set(list(T)) = set(T).

@@ -33,7 +33,7 @@
 	% `set__sorted_list_to_set(List, Set)' is true iff `Set' is the set
 	% containing only the members of `List'.  `List' must be sorted
 	% and must not contain any duplicates.
-
+	%
 :- pred set__sorted_list_to_set(list(T)::in, set(T)::out) is det.
 :- func set__sorted_list_to_set(list(T)) = set(T).

@@ -44,18 +44,18 @@
 	% `set__to_sorted_list(Set, List)' is true iff `List' is the list
 	% of all the members of `Set', in sorted order without any
 	% duplicates.
-
+	%
 :- pred set__to_sorted_list(set(T)::in, list(T)::out) is det.
 :- func set__to_sorted_list(set(T)) = list(T).

 	% `set__init(Set)' is true iff `Set' is an empty set.
-
+	%
 :- pred set__init(set(T)::uo) is det.
 :- func set__init = set(T).

 	% `set__singleton_set(Set, Elem)' is true iff `Set' is the set
 	% containing just the single element `Elem'.
-
+	%
 :- pred set__singleton_set(set(T), T).
 :- mode set__singleton_set(in, out) is semidet.
 :- mode set__singleton_set(out, in) is det.
@@ -64,7 +64,7 @@

 	% `set__equal(SetA, SetB)' is true iff
 	% `SetA' and `SetB' contain the same elements.
-
+	%
 :- pred set__equal(set(T)::in, set(T)::in) is semidet.

 :- pred set__empty(set(T)::in) is semidet.
@@ -72,84 +72,84 @@
 :- pred set__non_empty(set(T)::in) is semidet.

 	% `set__subset(SetA, SetB)' is true iff `SetA' is a subset of `SetB'.
-
+	%
 :- pred set__subset(set(T)::in, set(T)::in) is semidet.

 	% `set__superset(SetA, SetB)' is true iff `SetA' is a
 	% superset of `SetB'.
-
+	%
 :- pred set__superset(set(T)::in, set(T)::in) is semidet.

 	% `set__member(X, Set)' is true iff `X' is a member of `Set'.
-
+	%
 :- pred set__member(T, set(T)).
 :- mode set__member(in, in) is semidet.
 :- mode set__member(out, in) is nondet.

 	% `set_is_member(X, Set, Result)' returns
 	% `Result = yes' iff `X' is a member of `Set'.
-
+	%
 :- pred set__is_member(T::in, set(T)::in, bool::out) is det.

 	% `set__contains(Set, X)' is true iff `X' is a member of `Set'.
-
+	%
 :- pred set__contains(set(T)::in, T::in) is semidet.

 	% `set__insert(Set0, X, Set)' is true iff `Set' is the union of
 	% `Set0' and the set containing only `X'.
-
-:- pred set__insert(set(T), T, set(T)).
-:- mode set__insert(di, di, uo) is det.
-:- mode set__insert(in, in, out) is det.
+	%
+:- pred set__insert(set(T)::in, T::in, set(T)::out) is det.

 	% XXX rwab1: I think we should reverse the args. here for
 	% higher order programming.
+	%
 :- func set__insert(set(T), T) = set(T).

 	% `set__insert_list(Set0, Xs, Set)' is true iff `Set' is the union of
 	% `Set0' and the set containing only the members of `Xs'.
-
+	%
 :- pred set__insert_list(set(T)::in, list(T)::in, set(T)::out) is det.

 	% XXX rwab1: I think we should reverse the args. here for
 	% higher order programming.
+	%
 :- func set__insert_list(set(T), list(T)) = set(T).

 	% `set__delete(Set0, X, Set)' is true iff `Set' is the relative
 	% complement of `Set0' and the set containing only `X', i.e.
 	% if `Set' is the set which contains all the elements of `Set0'
 	% except `X'.
-
-:- pred set__delete(set(T), T, set(T)).
-% :- mode set__delete(di, in, uo) is det.
-:- mode set__delete(in, in, out) is det.
+	%
+:- pred set__delete(set(T)::in, T::in, set(T)::out) is det.

 	% XXX rwab1: I think we should reverse the args. here for
 	% higher order programming.
+	%
 :- func set__delete(set(T), T) = set(T).

 	% `set__delete_list(Set0, Xs, Set)' is true iff `Set' is the relative
 	% complement of `Set0' and the set containing only the members of
 	% `Xs'.
-
+	%
 :- pred set__delete_list(set(T)::in, list(T)::in, set(T)::out) is det.

 	% XXX rwab1: I think we should reverse the args. here for
 	% higher order programming.
+	%
 :- func set__delete_list(set(T), list(T)) = set(T).

 	% `set__remove(Set0, X, Set)' is true iff `Set0' contains `X',
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only `X', i.e.  if `Set' is the set which contains
 	% all the elements of `Set0' except `X'.
-
+	%
 :- pred set__remove(set(T)::in, T::in, set(T)::out) is semidet.

 	% `set__remove_list(Set0, Xs, Set)' is true iff `Xs' does not
 	% contain any duplicates, `Set0' contains every member of `Xs',
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only the members of `Xs'.
-
+	%
 :- pred set__remove_list(set(T)::in, list(T)::in, set(T)::out) is semidet.

 	% `set__remove_least(Set0, Elem, Set)' is true iff
@@ -157,7 +157,7 @@
 	% (with elements ordered using the standard ordering given
 	% by compare/3), and `Set' is the set containing all the
 	% elements of `Set0' except `Elem'.
-
+	%
 :- pred set__remove_least(set(T)::in, T::out, set(T)::out) is semidet.

 	% `set_union(SetA, SetB, Set)' is true iff `Set' is the union of
@@ -168,17 +168,18 @@
 	% but other set implementations may be, so observing this convention
 	% will make it less likely that you will encounter problems if
 	% the implementation is changed.)
-
+	%
 :- pred set__union(set(T)::in, set(T)::in, set(T)::out) is det.
 :- func set__union(set(T), set(T)) = set(T).

 	% `set__union_list(A, B)' is true iff `B' is the union of
-	% all the sets in `A'
+	% all the sets in `A'.
+	%
 :- func set__union_list(list(set(T))) = set(T).

 	% `set__power_union(A, B)' is true iff `B' is the union of
-	% all the sets in `A'
-
+	% all the sets in `A'.
+	%
 :- pred set__power_union(set(set(T))::in, set(T)::out) is det.
 :- func set__power_union(set(set(T))) = set(T).

@@ -191,30 +192,30 @@
 	% but other set implementations may be, so observing this convention
 	% will make it less likely that you will encounter problems if
 	% the implementation is changed.)
-
+	%
 :- pred set__intersect(set(T)::in, set(T)::in, set(T)::out) is det.
 :- func set__intersect(set(T), set(T)) = set(T).

 	% `set__power_intersect(A, B)' is true iff `B' is the intersection of
-	% all the sets in `A'
-
+	% all the sets in `A'.
+	%
 :- pred set__power_intersect(set(set(T))::in, set(T)::out) is det.
 :- func set__power_intersect(set(set(T))) = set(T).

 	% `set__intersect_list(A, B)' is true iff `B' is the intersection of
-	% all the sets in `A'
-
+	% all the sets in `A'.
+	%
 :- func set__intersect_list(list(set(T))) = set(T).

 	% `set__difference(SetA, SetB, Set)' is true iff `Set' is the
 	% set containing all the elements of `SetA' except those that
-	% occur in `SetB'
-
+	% occur in `SetB'.
+	%
 :- pred set__difference(set(T)::in, set(T)::in, set(T)::out) is det.
 :- func set__difference(set(T), set(T)) = set(T).

 	% `set__count(Set, Count)' is true iff `Set' has `Count' elements.
-
+	%
 :- pred set__count(set(T)::in, int::out) is det.
 :- func set__count(set(T)) = int.

@@ -229,6 +230,7 @@
 	%	L0 = set__to_sorted_list(S0),
 	%	list__map_foldl(P, L0, L, A0, A),
 	%	S = set__list_to_set(L).
+	%
 :- pred set__map_fold(pred(T1, T2, T3, T3), set(T1), set(T2), T3, T3).
 :- mode set__map_fold(pred(in, out, in, out) is det, in, out, in, out) is det.

@@ -265,10 +267,12 @@
 	% InPart consists of those elements of Set which are also in
 	% DivideBySet; OutPart consists of those elements of which are
 	% not in DivideBySet.
+	%
 :- pred set__divide_by_set(set(T)::in, set(T)::in, set(T)::out, set(T)::out)
 	is det.

 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%

 :- implementation.

Index: library/set_bbbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_bbbtree.m,v
retrieving revision 1.22
diff -u -r1.22 set_bbbtree.m
--- library/set_bbbtree.m	18 Jan 2005 04:27:17 -0000	1.22
+++ library/set_bbbtree.m	19 Jan 2005 03:02:00 -0000
@@ -21,53 +21,53 @@
 :- type set_bbbtree(T).

 	% `set_bbbtree__init(Set)' returns an initialized empty set.
-
+	%
 :- pred set_bbbtree__init(set_bbbtree(T)::uo) is det.
 :- func set_bbbtree__init = set_bbbtree(T).

         % `set_bbbtree__empty(Set) is true iff `Set' is contains no elements.
-
+	%
 :- pred set_bbbtree__empty(set_bbbtree(T)::in) is semidet.

 	% `set_bbbtree__size(Set, Size)' is true iff `Size' is the cardinality
 	% of `Set'.
-
+	%
 :- pred set_bbbtree__size(set_bbbtree(T)::in, int::out) is det.

 	% `set_bbbtree__member(X, Set)' is true iff `X' is a member of `Set'.
 	% O(lg n) for (in, in) and O(1) for (out, in).
-
+	%
 :- pred set_bbbtree__member(T, set_bbbtree(T)).
 :- mode set_bbbtree__member(in, in) is semidet.
 :- mode set_bbbtree__member(out, in) is nondet.

 	% `set_bbbtree__is_member(X, Set, Result)' is true iff `X' is a member
 	% of `Set'.
-
+	%
 :- pred set_bbbtree__is_member(T::in, set_bbbtree(T)::in, bool::out) is det.

 	% `set_bbbtree__contains(Set, X)' is true iff `X' is a member of `Set'.
 	% O(lg n).
-
+	%
 :- pred set_bbbtree__contains(set_bbbtree(T)::in, T::in) is semidet.

 	% `set_bbbtree__least(Set, X)' is true iff `X' is smaller than all
 	% the other members of `Set'.
-
+	%
 :- pred set_bbbtree__least(set_bbbtree(T), T).
 :- mode set_bbbtree__least(in, out) is semidet.
 :- mode set_bbbtree__least(in, in) is semidet.

 	% `set_bbbtree__largest(Set, X)' is true iff `X' is larger than all
 	% the other members of `Set'.
-
+	%
 :- pred set_bbbtree__largest(set_bbbtree(T), T).
 :- mode set_bbbtree__largest(in, out) is semidet.
 :- mode set_bbbtree__largest(in, in) is semidet.

 	% `set_bbbtree__singleton_set(Set, X)' is true iff `Set' is the set
 	% containing just the single element `X'.
-
+	%
 :- pred set_bbbtree__singleton_set(set_bbbtree(T), T).
 :- mode set_bbbtree__singleton_set(uo, di) is det.
 :- mode set_bbbtree__singleton_set(in, out) is semidet.
@@ -78,12 +78,12 @@

 	% `set_bbbtree__equal(SetA, SetB)' is true iff `SetA' and `SetB'
 	% contain the same elements.
-
+	%
 :- pred set_bbbtree__equal(set_bbbtree(T)::in, set_bbbtree(T)::in) is semidet.

 	% `set_bbbtree__insert(Set0, X, Set)' is true iff `Set' is the union of
 	% `Set0' and the set containing only `X'.
-
+	%
 :- pred set_bbbtree__insert(set_bbbtree(T), T, set_bbbtree(T)).
 :- mode set_bbbtree__insert(di, di, uo) is det.
 :- mode set_bbbtree__insert(in, in, out) is det.
@@ -92,7 +92,7 @@

 	% `set_bbbtree__insert_list(Set0, Xs, Set)' is true iff `Set' is
 	% the union of `Set0' and the set containing only the members of `Xs'.
-
+	%
 :- pred set_bbbtree__insert_list(set_bbbtree(T)::in, list(T)::in,
 	set_bbbtree(T)::out) is det.

@@ -102,7 +102,7 @@
 	% complement of `Set0' and the set containing only `X', i.e.
 	% if `Set' is the set which contains all the elements of `Set0'
 	% except `X'.
-
+	%
 :- pred set_bbbtree__delete(set_bbbtree(T), T, set_bbbtree(T)).
 :- mode set_bbbtree__delete(di, in, uo) is det.
 :- mode set_bbbtree__delete(in, in, out) is det.
@@ -112,7 +112,7 @@
 	% `set_bbbtree__delete_list(Set0, Xs, Set)' is true iff `Set' is the
 	% relative complement of `Set0' and the set containing only the members
 	% of `Xs'.
-
+	%
 :- pred set_bbbtree__delete_list(set_bbbtree(T)::in, list(T)::in,
 	set_bbbtree(T)::out) is det.

@@ -122,7 +122,7 @@
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only `X', i.e.  if `Set' is the set which contains
 	% all the elements of `Set0' except `X'.
-
+	%
 :- pred set_bbbtree__remove(set_bbbtree(T)::in, T::in, set_bbbtree(T)::out)
 	is semidet.

@@ -130,27 +130,27 @@
 	% contain any duplicates, `Set0' contains every member of `Xs',
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only the members of `Xs'.
-
+	%
 :- pred set_bbbtree__remove_list(set_bbbtree(T)::in, list(T)::in,
 	set_bbbtree(T)::out) is semidet.

 	% `set_bbbtree__remove_least(Set0, X, Set)' is true iff the union if
 	% `X' and `Set' is `Set0' and `X' is smaller than all the elements of
 	% `Set'.
-
+	%
 :- pred set_bbbtree__remove_least(set_bbbtree(T)::in, T::out,
 	set_bbbtree(T)::out) is semidet.

 	% `set_bbbtree__remove_largest(Set0, X, Set)' is true iff the union if
 	% `X' and `Set' is `Set0' and `X' is larger than all the elements of
 	% `Set'.
-
+	%
 :- pred set_bbbtree__remove_largest(set_bbbtree(T)::in, T::out,
 	set_bbbtree(T)::out) is semidet.

 	% `set_bbbtree__list_to_set(List, Set)' is true iff `Set' is the set
 	% containing only the members of `List'. O(n lg n)
-
+	%
 :- pred set_bbbtree__list_to_set(list(T)::in, set_bbbtree(T)::out) is det.

 :- func set_bbbtree__list_to_set(list(T)) = set_bbbtree(T).
@@ -162,7 +162,7 @@
 	% `set_bbbtree__sorted_list_to_set(List, Set)' is true iff `Set' is the
 	% set containing only the members of `List'.
 	% `List' must be sorted. O(n).
-
+	%
 :- pred set_bbbtree__sorted_list_to_set(list(T)::in, set_bbbtree(T)::out)
 	is det.

@@ -179,13 +179,13 @@
 	% `set_bbbtree__sorted_list_to_set' as a significant cost involved
 	% with `set_bbbtree__sorted_list_to_set' is the call to list__length.
 	% `List' must be sorted. O(n).
-
+	%
 :- pred set_bbbtree__sorted_list_to_set_len(list(T)::in, set_bbbtree(T)::out,
 	int::in) is det.

 	% `set_bbbtree__to_sorted_list(Set, List)' is true iff `List' is the
 	% list of all the members of `Set', in sorted order. O(n).
-
+	%
 :- pred set_bbbtree__to_sorted_list(set_bbbtree(T), list(T)).
 :- mode set_bbbtree__to_sorted_list(di, uo) is det.
 :- mode set_bbbtree__to_sorted_list(in, out) is det.
@@ -194,7 +194,7 @@

 	% `set_bbbtree__union(SetA, SetB, Set)' is true iff `Set' is the union
 	% of `SetA' and `SetB'.
-
+	%
 :- pred set_bbbtree__union(set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out) is det.

@@ -202,12 +202,12 @@

 	% `set_bbbtree__union_list(Sets) = Set' is true iff `Set' is the union
 	% of all the sets in `Sets'
-
+	%
 :- func set_bbbtree__union_list(list(set_bbbtree(T))) = set_bbbtree(T).

 	% `set_bbbtree__power_union(Sets, Set)' is true iff `Set' is the union
 	% of all the sets in `Sets'
-
+	%
 :- pred set_bbbtree__power_union(set_bbbtree(set_bbbtree(T))::in,
 	set_bbbtree(T)::out) is det.

@@ -215,7 +215,7 @@

 	% `set_bbbtree__intersect(SetA, SetB, Set)' is true iff `Set' is the
 	% intersection of `SetA' and `SetB'.
-
+	%
 :- pred set_bbbtree__intersect(set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out) is det.

@@ -223,7 +223,7 @@

 	% `set_bbbtree__power_intersect(Sets, Set) is true iff `Set' is the
 	% intersection of the sets in `Sets'.
-
+	%
 :- pred set_bbbtree__power_intersect(set_bbbtree(set_bbbtree(T))::in,
 	set_bbbtree(T)::out) is det.

@@ -232,13 +232,13 @@

 	% `set_bbbtree__intersect_list(Sets) = Set is true iff `Set' is the
 	% intersection of the sets in `Sets'.
-
+	%
 :- func set_bbbtree__intersect_list(list(set_bbbtree(T))) = set_bbbtree(T).

 	% `set_bbtree__difference(SetA, SetB, Set)' is true iff `Set' is the
 	%  set containing all the elements of `SetA' except those that
 	% occur in `SetB'.
-
+	%
 :- pred set_bbbtree__difference(set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out) is det.

@@ -247,12 +247,12 @@

 	% `set_bbbtree__subset(SetA, SetB)' is true iff all the elements of
 	% `SetA' are also elements of `SetB'.
-
+	%
 :- pred set_bbbtree__subset(set_bbbtree(T)::in, set_bbbtree(T)::in) is semidet.

 	% `set_bbbtree__superset(SetA, SetB)' is true iff all the elements of
 	% `SetB' are also elements of `SetA'.
-
+	%
 :- pred set_bbbtree__superset(set_bbbtree(T)::in, set_bbbtree(T)::in)
 	is semidet.

Index: library/set_ordlist.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_ordlist.m,v
retrieving revision 1.19
diff -u -r1.19 set_ordlist.m
--- library/set_ordlist.m	18 Jan 2005 04:27:17 -0000	1.19
+++ library/set_ordlist.m	19 Jan 2005 05:06:45 -0000
@@ -21,7 +21,7 @@

 	% `set_ordlist__list_to_set(List, Set)' is true iff `Set' is the set
 	% containing only the members of `List'.
-
+	%
 :- pred set_ordlist__list_to_set(list(T)::in, set_ordlist(T)::out) is det.
 :- func set_ordlist__list_to_set(list(T)) = set_ordlist(T).

@@ -31,7 +31,7 @@

 	% `set_ordlist__sorted_list_to_set(List, Set)' is true iff `Set' is
 	% the set containing only the members of `List'.  `List' must be sorted.
-
+	%
 :- pred set_ordlist__sorted_list_to_set(list(T)::in, set_ordlist(T)::out)
 	is det.
 :- func set_ordlist__sorted_list_to_set(list(T)) = set_ordlist(T).
@@ -42,18 +42,18 @@

 	% `set_ordlist__to_sorted_list(Set, List)' is true iff `List' is the
 	% list of all the members of `Set', in sorted order.
-
+	%
 :- pred set_ordlist__to_sorted_list(set_ordlist(T)::in, list(T)::out) is det.
 :- func set_ordlist__to_sorted_list(set_ordlist(T)) = list(T).

 	% `set_ordlist__init(Set)' is true iff `Set' is an empty set.
-
+	%
 :- pred set_ordlist__init(set_ordlist(_T)::uo) is det.
 :- func set_ordlist__init = set_ordlist(T).

 	% `set_ordlist__singleton_set(Set, Elem)' is true iff `Set' is the set
 	% containing just the single element `Elem'.
-
+	%
 :- pred set_ordlist__singleton_set(set_ordlist(T), T).
 :- mode set_ordlist__singleton_set(in, out) is semidet.
 :- mode set_ordlist__singleton_set(out, in) is det.
@@ -62,51 +62,50 @@

 	% `set_ordlist__equal(SetA, SetB)' is true iff
 	% `SetA' and `SetB' contain the same elements.
-
+	%
 :- pred set_ordlist__equal(set_ordlist(T)::in, set_ordlist(T)::in) is semidet.

 	% `set_ordlist__empty(Set)' is true iff `Set' is an empty set.
-
+	%
 :- pred set_ordlist__empty(set_ordlist(_T)::in) is semidet.

 	% `set_ordlist__subset(SetA, SetB)' is true iff `SetA' is a subset of
 	% `SetB'.
-
+	%
 :- pred set_ordlist__subset(set_ordlist(T)::in, set_ordlist(T)::in) is semidet.

 	% `set_ordlist__superset(SetA, SetB)' is true iff `SetA' is a
 	% superset of `SetB'.
-
+	%
 :- pred set_ordlist__superset(set_ordlist(T)::in, set_ordlist(T)::in)
 	is semidet.

 	% `set_ordlist__member(X, Set)' is true iff `X' is a member of `Set'.
-
+	%
 :- pred set_ordlist__member(T, set_ordlist(T)).
 :- mode set_ordlist__member(in, in) is semidet.
 :- mode set_ordlist__member(out, in) is nondet.

 	% `set_ordlist__is_member(X, Set, Result)' returns
 	% `Result = yes' iff `X' is a member of `Set'.
-
+	%
 :- pred set_ordlist__is_member(T::in, set_ordlist(T)::in, bool::out) is det.

 	% `set_ordlist__contains(Set, X)' is true iff `X' is a member of `Set'.
-
+	%
 :- pred set_ordlist__contains(set_ordlist(T)::in, T::in) is semidet.

 	% `set_ordlist__insert(Set0, X, Set)' is true iff `Set' is the union
 	% of `Set0' and the set containing only `X'.
-
-:- pred set_ordlist__insert(set_ordlist(T), T, set_ordlist(T)).
-:- mode set_ordlist__insert(di, di, uo) is det.
-:- mode set_ordlist__insert(in, in, out) is det.
+	%
+:- pred set_ordlist__insert(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
+	is det.

 :- func set_ordlist__insert(set_ordlist(T), T) = set_ordlist(T).

 	% `set_ordlist__insert_list(Set0, Xs, Set)' is true iff `Set' is the
 	% union of `Set0' and the set containing only the members of `Xs'.
-
+	%
 :- pred set_ordlist__insert_list(set_ordlist(T)::in, list(T)::in,
 	set_ordlist(T)::out) is det.
 :- func set_ordlist__insert_list(set_ordlist(T), list(T)) = set_ordlist(T).
@@ -115,7 +114,7 @@
 	% relative complement of `Set0' and the set containing only `X', i.e.
 	% if `Set' is the set which contains all the elements of `Set0'
 	% except `X'.
-
+	%
 :- pred set_ordlist__delete(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
 	is det.
 :- func set_ordlist__delete(set_ordlist(T), T) = set_ordlist(T).
@@ -123,7 +122,7 @@
 	% `set_ordlist__delete_list(Set0, Xs, Set)' is true iff `Set' is the
 	% relative complement of `Set0' and the set containing only the members
 	% of `Xs'.
-
+	%
 :- pred set_ordlist__delete_list(set_ordlist(T)::in, list(T)::in,
 	set_ordlist(T)::out) is det.
 :- func set_ordlist__delete_list(set_ordlist(T), list(T)) = set_ordlist(T).
@@ -132,7 +131,7 @@
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only `X', i.e.  if `Set' is the set which contains
 	% all the elements of `Set0' except `X'.
-
+	%
 :- pred set_ordlist__remove(set_ordlist(T)::in, T::in, set_ordlist(T)::out)
 	is semidet.

@@ -140,7 +139,7 @@
 	% contain any duplicates, `Set0' contains every member of `Xs',
 	% and `Set' is the relative complement of `Set0' and the set
 	% containing only the members of `Xs'.
-
+	%
 :- pred set_ordlist__remove_list(set_ordlist(T)::in, list(T)::in,
 	set_ordlist(T)::out) is semidet.

@@ -155,7 +154,7 @@
 	% of `SetA' and `SetB'. The efficiency of the union operation is
 	% O(card(SetA)+card(SetB)) and is not sensitive to the argument
 	% ordering.
-
+	%
 :- pred set_ordlist__union(set_ordlist(T)::in, set_ordlist(T)::in,
 	set_ordlist(T)::out) is det.

@@ -163,12 +162,12 @@

 	% `set_ordlist__union_list(A, B)' is true iff `B' is the union of
 	% all the sets in `A'
-
+	%
 :- func set_ordlist__union_list(list(set_ordlist(T))) = set_ordlist(T).

 	% `set_ordlist__power_union(A, B)' is true iff `B' is the union of
 	% all the sets in `A'
-
+	%
 :- pred set_ordlist__power_union(set_ordlist(set_ordlist(T))::in,
 	set_ordlist(T)::out) is det.

@@ -177,7 +176,7 @@
 	% `set_ordlist__intersect(SetA, SetB, Set)' is true iff `Set' is the
 	% intersection of `SetA' and `SetB'. The efficiency of the intersection
 	% operation is not influenced by the argument order.
-
+	%
 :- pred set_ordlist__intersect(set_ordlist(T), set_ordlist(T), set_ordlist(T)).
 :- mode set_ordlist__intersect(in, in, out) is det.
 :- mode set_ordlist__intersect(in, in, in) is semidet.
@@ -187,7 +186,7 @@

 	% `set_ordlist__power_intersect(A, B)' is true iff `B' is the
 	% intersection of all the sets in `A'.
-
+	%
 :- pred set_ordlist__power_intersect(set_ordlist(set_ordlist(T))::in,
 	set_ordlist(T)::out) is det.
 :- func set_ordlist__power_intersect(set_ordlist(set_ordlist(T)))
@@ -201,7 +200,7 @@
 	% `set_ordlist__difference(SetA, SetB, Set)' is true iff `Set' is the
 	% set containing all the elements of `SetA' except those that
 	% occur in `SetB'.
-
+	%
 :- pred set_ordlist__difference(set_ordlist(T)::in, set_ordlist(T)::in,
 	set_ordlist(T)::out) is det.
 :- func set_ordlist__difference(set_ordlist(T), set_ordlist(T))
@@ -209,7 +208,7 @@

 	% `set_ordlist__count(Set, Count)' is true iff `Set' has
 	% `Count' elements.
-
+	%
 :- pred set_ordlist__count(set_ordlist(T)::in, int::out) is det.
 :- func set_ordlist__count(set_ordlist(T)) = int.

@@ -224,6 +223,7 @@
 	% set_ordlist__divide(Pred, Set, TruePart, FalsePart):
 	% TruePart consists of those elements of Set for which Pred succeeds;
 	% FalsePart consists of those elements of Set for which Pred fails.
+	%
 :- pred set_ordlist__divide(pred(T)::in(pred(in) is semidet),
 	set_ordlist(T)::in, set_ordlist(T)::out, set_ordlist(T)::out)
 	is det.
@@ -232,10 +232,12 @@
 	% InPart consists of those elements of Set which are also in
 	% DivideBySet; OutPart consists of those elements of which are
 	% not in DivideBySet.
+	%
 :- pred set_ordlist__divide_by_set(set_ordlist(T)::in, set_ordlist(T)::in,
 	set_ordlist(T)::out, set_ordlist(T)::out) is det.

 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%

 :- implementation.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list