[m-rev.] New names etc. as part of library standardization

Ralph Becket rafe at cs.mu.OZ.AU
Mon Jan 31 18:11:11 AEDT 2005


Estimated hours taken: 3
Branches: main, version-0_12-branch

library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
	Minor reformatting; added some renamed preds and funcs to improve
	consistency of naming in the library; removed some preds and types that
	have been marked obsolete since 0.11.

Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.136
diff -u -r1.136 array.m
--- library/array.m	24 Jan 2005 23:16:35 -0000	1.136
+++ library/array.m	31 Jan 2005 02:53:20 -0000
@@ -136,6 +136,10 @@
 :- mode array__min(array_ui) = out is det.
 :- mode array__min(in) = out is det.
 
+:- func array__least_index(array(T)) = int.
+:- mode array__least_index(array_ui) = out is det.
+:- mode array__least_index(in) = out is det.
+
 	% array__max returns the upper bound of the array.
 	%
 :- pred array__max(array(_T), int).
@@ -146,6 +150,10 @@
 :- mode array__max(array_ui) = out is det.
 :- mode array__max(in) = out is det.
 
+:- func array__greatest_index(array(T)) = int.
+:- mode array__greatest_index(array_ui) = out is det.
+:- mode array__greatest_index(in) = out is det.
+
 	% array__size returns the length of the array,
 	% i.e. upper bound - lower bound + 1.
 	%
@@ -1682,6 +1690,12 @@
 	throw(array__index_out_of_bounds(
 		string__format("%s: index %d not in range [%d, %d]",
 			[s(PredName), i(Index), i(Min), i(Max)]))).
+
+%-----------------------------------------------------------------------------%
+
+array__least_index(A) = array__min(A).
+
+array__greatest_index(A) = array__max(A).
 
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
Index: library/array2d.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array2d.m,v
retrieving revision 1.1
diff -u -r1.1 array2d.m
--- library/array2d.m	23 Jan 2003 04:25:46 -0000	1.1
+++ library/array2d.m	31 Jan 2005 06:34:13 -0000
@@ -39,7 +39,6 @@
 
 
 
-
     % array2d([[X11, ..., X1N], ..., [XM1, ..., XMN]]) constructs a array2d
     % of size M * N, with the special case that bounds(array2d([]), 0, 0).
     %
@@ -48,6 +47,11 @@
 :- func array2d(list(list(T))) = array2d(T).
 :- mode array2d(in           ) = array2d_uo is det.
 
+    % A synonym for the above.
+    %
+:- func from_lists(list(list(T))) = array2d(T).
+:- mode from_lists(in           ) = array2d_uo is det.
+
     % new(M, N, X) = array2d([[X11, ..., X1N], ..., [XM1, ..., XMN]])
     % where each XIJ = X.  An exception is thrown if M < 0 or N < 0.
     %
@@ -80,12 +84,22 @@
 :- func ( array2d(T) ^ elem(int, int) := T  ) = array2d(T).
 :- mode ( array2d_di ^ elem(in,  in)  := in ) = array2d_uo is det.
 
+    % Pred version of the above.
+    %
+:- pred set(int, int, T,  array2d(T), array2d(T)).
+:- mode set(in,  in,  in, array2d_di, array2d_uo) is det.
+
     % T ^ unsafe_elem(I, J) := X is the same as T ^ elem(I, J) := X except
     % that behaviour is undefined if not in_bounds(T, I, J).
     %
 :- func ( array2d(T) ^ unsafe_elem(int, int) := T  ) = array2d(T).
 :- mode ( array2d_di ^ unsafe_elem(in,  in)  := in ) = array2d_uo is det.
 
+    % Pred version of the above.
+    %
+:- pred unsafe_set(int, int, T,  array2d(T), array2d(T)).
+:- mode unsafe_set(in,  in,  in, array2d_di, array2d_uo) is det.
+
     % bounds(array2d([[X11, ..., X1N], ..., [XM1, ..., XMN]), M, N)
     %
 :- pred bounds(array2d(T), int, int).
@@ -104,7 +118,7 @@
     %
 :- func lists(array2d(T)) = list(list(T)).
 :- mode lists(array2d_ui) = out is det.
-:- mode lists(in      ) = out is det.
+:- mode lists(in        ) = out is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -132,6 +146,9 @@
           else  func_error("array2d.array2d/1: non-rectangular list of lists")
         ).
 
+
+from_lists(Xss) = array2d(Xss).
+
 %-----------------------------------------------------------------------------%
 
 new(M, N, X) =
@@ -170,10 +187,16 @@
       else  func_error("array2d.'elem :=': indices out of bounds")
     ).
 
+
+set(I, J, X, A, A ^ elem(I, J) := X).
+
 %-----------------------------------------------------------------------------%
 
 ( array2d(M, N, A) ^ unsafe_elem(I, J) := X ) = 
     array2d(M, N, A ^ elem(I * N + J) := X).
+
+
+unsafe_set(I, J, X, A, A ^ unsafe_elem(I, J) := X).
 
 %-----------------------------------------------------------------------------%
 
Index: library/assoc_list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/assoc_list.m,v
retrieving revision 1.15
diff -u -r1.15 assoc_list.m
--- library/assoc_list.m	24 Jan 2005 23:16:36 -0000	1.15
+++ library/assoc_list.m	31 Jan 2005 06:08:41 -0000
@@ -60,6 +60,15 @@
 	%
 :- pred assoc_list__search(assoc_list(K, V)::in, K::in, V::out) is semidet.
 
+	% An alternative version of assoc_list__search.
+	%
+:- func assoc_list(K, V) ^ elem(K)     = V is semidet.
+
+	% An alternative version of assoc_list__search that throws an
+	% exception if the key in question does not appear in the assoc_list.
+	%
+:- func assoc_list(K, V) ^ det_elem(K) = V is det.
+
 	% Find the first element of the association list that matches
 	% the given key. Return the associated value, and the original
 	% list with the selected element removed.
@@ -163,3 +172,13 @@
 assoc_list__map_values(F, [K - V0 | KVs0]) = [K - V | KVs] :-
 	V = apply(F, K, V0),
 	KVs = assoc_list__map_values(F, KVs0).
+
+AL ^ elem(K) = V :-
+	assoc_list__search(AL, K, V).
+
+AL ^ det_elem(K) = V :-
+	( if   assoc_list__search(AL, K, V0)
+	  then V = V0
+	  else report_lookup_error("assoc_list__det_elem: key not found", K)
+	).
+
Index: library/bag.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bag.m,v
retrieving revision 1.24
diff -u -r1.24 bag.m
--- library/bag.m	10 Jan 2005 05:23:45 -0000	1.24
+++ library/bag.m	31 Jan 2005 03:08:45 -0000
@@ -42,6 +42,7 @@
 
 	% Make a bag from a list.
 	%
+:- func bag__bag(list(T)) = bag(T).
 :- pred bag__from_list(list(T)::in, bag(T)::out) is det.
 :- func bag__from_list(list(T)) = bag(T).
 
@@ -75,6 +76,7 @@
 	%
 :- pred bag__to_set_without_duplicates(bag(T)::in, set(T)::out) is det.
 :- func bag__to_set_without_duplicates(bag(T)) = set(T).
+:- func bag__to_set(bag(T)) = set(T).
 
 	% Remove one occurrence of a particular value from a bag.
 	% Fail if the item does not exist in the bag.
@@ -549,3 +551,7 @@
 
 bag__least_upper_bound(B1, B2) = B3 :-
 	bag__least_upper_bound(B1, B2, B3).
+
+bag__bag(Xs) = bag__from_list(Xs).
+
+bag__to_set(B) = bag__to_set_without_duplicates(B).
Index: library/benchmarking.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.61
diff -u -r1.61 benchmarking.m
--- library/benchmarking.m	19 Mar 2004 10:41:18 -0000	1.61
+++ library/benchmarking.m	31 Jan 2005 03:10:10 -0000
@@ -17,31 +17,31 @@
 :- module benchmarking.
 :- interface.
 
-% `report_stats' is a non-logical procedure intended for use in profiling
-% the performance of a program.
-% It has the side-effect of reporting some memory and time usage statistics
-% about the time period since the last call to report_stats to stderr.
-
+	% `report_stats' is a non-logical procedure intended for use in
+	% profiling the performance of a program.  It has the side-effect of
+	% reporting some memory and time usage statistics about the time period
+	% since the last call to report_stats to stderr.
+	%
 :- impure pred report_stats is det.
 
-% `report_full_memory_stats' is a non-logical procedure intended for use
-% in profiling the memory usage of a program.  It has the side-effect of
-% reporting a full memory profile to stderr.
-
+	% `report_full_memory_stats' is a non-logical procedure intended for
+	% use in profiling the memory usage of a program.  It has the
+	% side-effect of reporting a full memory profile to stderr.
+	%
 :- impure pred report_full_memory_stats is det.
 
-% benchmark_det(Pred, In, Out, Repeats, Time) is for benchmarking the
-% det predicate Pred. We call Pred with the input In and the output Out,
-% and return Out so that the caller can check the correctness of the
-% benchmarked predicate. Since most systems do not have good facilities
-% for measuring small times, the Repeats parameter allows the caller to
-% specify how many times Pred should be called inside the timed interval.
-% The number of milliseconds required to execute Pred with input In this
-% many times is returned as Time.
-%
-% benchmark_func(Func, In, Out, Repeats, Time) does for functions exactly
-% what benchmark_det does for predicates.
-
+	% benchmark_det(Pred, In, Out, Repeats, Time) is for benchmarking the
+	% det predicate Pred. We call Pred with the input In and the output
+	% Out, and return Out so that the caller can check the correctness of
+	% the benchmarked predicate. Since most systems do not have good
+	% facilities for measuring small times, the Repeats parameter allows
+	% the caller to specify how many times Pred should be called inside the
+	% timed interval.  The number of milliseconds required to execute Pred
+	% with input In this many times is returned as Time.
+	%
+	% benchmark_func(Func, In, Out, Repeats, Time) does for functions
+	% exactly what benchmark_det does for predicates.
+	%
 :- pred benchmark_det(pred(T1, T2), T1, T2, int, int).
 :- mode benchmark_det(pred(in, out) is det, in, out, in, out) is cc_multi.
 :- mode benchmark_det(pred(in, out) is cc_multi, in, out, in, out) is cc_multi.
@@ -53,17 +53,19 @@
 :- mode benchmark_det_io(pred(in, out, di, uo) is det, in, out, di, uo,
 	in, out) is cc_multi.
 
-% benchmark_nondet(Pred, In, Count, Repeats, Time) is for benchmarking
-% the nondet predicate Pred. benchmark_nondet is similar to benchmark_det,
-% but it returns only a count of the solutions, rather than solutions
-% themselves.  The number of milliseconds required to generate
-% all solutions of Pred with input In Repeats times is returned as Time.
-
+	% benchmark_nondet(Pred, In, Count, Repeats, Time) is for benchmarking
+	% the nondet predicate Pred. benchmark_nondet is similar to
+	% benchmark_det, but it returns only a count of the solutions, rather
+	% than solutions themselves.  The number of milliseconds required to
+	% generate all solutions of Pred with input In Repeats times is
+	% returned as Time.
+	% 
 :- pred benchmark_nondet(pred(T1, T2), T1, int, int, int).
 :- mode benchmark_nondet(pred(in, out) is nondet, in, out, in, out)
 	is cc_multi.
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 
 :- implementation.
 :- import_module int, std_util.
@@ -916,4 +918,5 @@
 	Ref.value = X;
 ").
 
+%-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/bimap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bimap.m,v
retrieving revision 1.16
diff -u -r1.16 bimap.m
--- library/bimap.m	24 Jan 2005 23:16:36 -0000	1.16
+++ library/bimap.m	31 Jan 2005 03:12:39 -0000
@@ -24,18 +24,18 @@
 
 %-----------------------------------------------------------------------------%
 
-:- type bimap(_K, _V).
+:- type bimap(K, V).
 
 %-----------------------------------------------------------------------------%
 
 	% Initialize an empty bimap.
 	%
-:- pred bimap__init(bimap(_, _)::out) is det.
-:- func bimap__init = bimap(_, _).
+:- pred bimap__init(bimap(K, V)::out) is det.
+:- func bimap__init = bimap(K, V).
 
 	% Check whether a bimap is empty.
 	%	
-:- pred bimap__is_empty(bimap(_, _)::in) is semidet.
+:- pred bimap__is_empty(bimap(K, V)::in) is semidet.
 
 :- pred bimap__search(bimap(K, V), K, V).
 :- mode bimap__search(in, in, out) is semidet.
@@ -55,13 +55,13 @@
 
 	% Given a bimap, return a list of all the keys in the bimap.
 	%
-:- pred bimap__ordinates(bimap(K, _V)::in, list(K)::out) is det.
-:- func bimap__ordinates(bimap(K, _V)) = list(K).
+:- pred bimap__ordinates(bimap(K, V)::in, list(K)::out) is det.
+:- func bimap__ordinates(bimap(K, V)) = list(K).
 
 	% Given a bimap, return a list of all the data values in the bimap.
 	%
-:- pred bimap__coordinates(bimap(_K, V)::in, list(V)::out) is det.
-:- func bimap__coordinates(bimap(_K, V)) = list(V).
+:- pred bimap__coordinates(bimap(K, V)::in, list(V)::out) is det.
+:- func bimap__coordinates(bimap(K, V)) = list(V).
 
 :- pred bimap__contains_key(bimap(K, V)::in, K::in) is semidet.
 
Index: library/bintree_set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bintree_set.m,v
retrieving revision 1.21
diff -u -r1.21 bintree_set.m
--- library/bintree_set.m	15 Mar 2004 23:49:30 -0000	1.21
+++ library/bintree_set.m	31 Jan 2005 03:13:20 -0000
@@ -7,7 +7,7 @@
 :- module bintree_set.
 
 % Main authors: fjh.
-% Stability: medium.
+% Stability: medium (obsolete).
 
 % This file provides an alternate implementation of the `set' ADT
 % defined in module `set'.  See that file for comments about the semantics
Index: library/bitmap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bitmap.m,v
retrieving revision 1.8
diff -u -r1.8 bitmap.m
--- library/bitmap.m	15 Mar 2004 23:49:30 -0000	1.8
+++ library/bitmap.m	31 Jan 2005 03:21:35 -0000
@@ -60,6 +60,15 @@
 :- func flip(bitmap, int) = bitmap.
 :- mode flip(bitmap_di, in) = bitmap_uo is det.
 
+:- pred set(int, bitmap, bitmap).
+:- mode set(in, bitmap_di, bitmap_uo) is det.
+
+:- pred clear(int, bitmap, bitmap).
+:- mode clear(in, bitmap_di, bitmap_uo) is det.
+
+:- pred flip(int, bitmap, bitmap).
+:- mode flip(in, bitmap_di, bitmap_uo) is det.
+
     % Unsafe versions of the above: if the index is out of range
     % then behaviour is undefined and bad things are likely to happen.
     %
@@ -72,6 +81,15 @@
 :- func unsafe_flip(bitmap, int) = bitmap.
 :- mode unsafe_flip(bitmap_di, in) = bitmap_uo is det.
 
+:- pred unsafe_set(int, bitmap, bitmap).
+:- mode unsafe_set(in, bitmap_di, bitmap_uo) is det.
+
+:- pred unsafe_clear(int, bitmap, bitmap).
+:- mode unsafe_clear(in, bitmap_di, bitmap_uo) is det.
+
+:- pred unsafe_flip(int, bitmap, bitmap).
+:- mode unsafe_flip(in, bitmap_di, bitmap_uo) is det.
+
     % is_set(BM, I) and is_clear(BM, I) succeed iff bit I in BM
     % is set or clear respectively.
     %
@@ -241,6 +259,12 @@
       else throw(software_error("bitmap__flip: out of range"))
     ).
 
+set(I, BM, set(BM, I)).
+
+clear(I, BM, clear(BM, I)).
+
+flip(I, BM, flip(BM, I)).
+
 % ---------------------------------------------------------------------------- %
 
 unsafe_set(BM, I) =
@@ -251,6 +275,12 @@
 
 unsafe_flip(BM, I) =
     BM ^ elem(int_offset(I)) := BM ^ elem(int_offset(I)) `xor` bitmask(I).
+
+unsafe_set(I, BM, unsafe_set(BM, I)).
+
+unsafe_clear(I, BM, unsafe_clear(BM, I)).
+
+unsafe_flip(I, BM, unsafe_flip(BM, I)).
 
 % ---------------------------------------------------------------------------- %
 
Index: library/bool.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bool.m,v
retrieving revision 1.11
diff -u -r1.11 bool.m
--- library/bool.m	24 Jan 2005 23:16:36 -0000	1.11
+++ library/bool.m	31 Jan 2005 03:24:57 -0000
@@ -45,6 +45,8 @@
 :- func bool__not(bool) = bool.
 :- pred bool__not(bool::in, bool::out) is det.
 
+:- func bool__xor(bool, bool) = bool.
+
 	% pred_to_bool(P) = (if P then yes else no).
 	%
 :- func pred_to_bool((pred)::((pred) is semidet)) = (bool::out) is det.
@@ -116,5 +118,10 @@
 bool__return_yes = yes.
 
 pred_to_bool(P) = (if P then yes else no).
+
+bool__xor(no,  no)  = no.
+bool__xor(no,  yes) = yes.
+bool__xor(yes, no)  = yes.
+bool__xor(yes, yes) = no.
 
 %-----------------------------------------------------------------------------%
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.109
diff -u -r1.109 builtin.m
--- library/builtin.m	27 Jan 2005 05:20:33 -0000	1.109
+++ library/builtin.m	31 Jan 2005 03:29:55 -0000
@@ -20,9 +20,9 @@
 :- interface.
 
 %-----------------------------------------------------------------------------%
-
+%
 % TYPES.
-
+%
 % The types `character', `int', `float', and `string',
 % and tuple types `{}', `{T}', `{T1, T2}', ...
 % and the types `pred', `pred(T)', `pred(T1, T2)', `pred(T1, T2, T3)', ...
@@ -32,38 +32,41 @@
 % these types.)
 
 % The type c_pointer can be used by predicates which use the C interface.
+%
 :- type c_pointer.
 
 %-----------------------------------------------------------------------------%
-
+%
 % INSTS.
-
+%
 % The standard insts `free', `ground', and `bound(...)' are builtin
 % and are implemented using special code in the parser and mode-checker.
-
+%
 % So are the standard unique insts `unique', `unique(...)',
 % `mostly_unique', `mostly_unique(...)', and `clobbered'.
-% The name `dead' is allowed as a synonym for `clobbered'.
-% Similarly `mostly_dead' is a synonym for `mostly_clobbered'.
+%
+% Higher-order predicate insts `pred(<modes>) is <detism>'
+% and higher-order functions insts `func(<modes>) = <mode> is det'
+% are also builtin.
 
+	% The name `dead' is allowed as a synonym for `clobbered'.
+	% Similarly `mostly_dead' is a synonym for `mostly_clobbered'.
+	%
 :- inst dead == clobbered.
 :- inst mostly_dead == mostly_clobbered.
 
-% The `any' inst used for the constraint solver interface is also builtin.
-% The insts `new' and `old' are allowed as synonyms for `free' and `any',
-% respectively, since some of the literature uses this terminology.
-
+	% The `any' inst used for the constraint solver interface is also
+	% builtin.  The insts `new' and `old' are allowed as synonyms for
+	% `free' and `any', respectively, since some of the literature uses
+	% this terminology.
+	%
 :- inst old == any.
 :- inst new == free.
 
-% Higher-order predicate insts `pred(<modes>) is <detism>'
-% and higher-order functions insts `func(<modes>) = <mode> is det'
-% are also builtin.
-
 %-----------------------------------------------------------------------------%
-
+%
 % MODES.
-
+%
 % The standard modes.
 
 :- mode unused == free >> free.
@@ -80,111 +83,116 @@
 
 % Unique modes.  These are still not fully implemented.
 
-% unique output
+	% unique output
+	%
 :- mode uo == free >> unique.
 
-% unique input
+	% unique input
+	%
 :- mode ui == unique >> unique.
 
-% destructive input
+	% destructive input
+	%
 :- mode di == unique >> clobbered.
 
 % "Mostly" unique modes (unique except that that may be referenced
 % again on backtracking).
 
-% mostly unique output
+	% mostly unique output
+	%
 :- mode muo == free >> mostly_unique.
 
-% mostly unique input
+	% mostly unique input
+	%
 :- mode mui == mostly_unique >> mostly_unique.
 
-% mostly destructive input
+	% mostly destructive input
+	%
 :- mode mdi == mostly_unique >> mostly_clobbered.
 
-% Higher-order predicate modes are builtin.
-
-% Solver type modes.
+	% Solver type modes.
+	%
 :- mode ia == any >> any.
 :- mode oa == free >> any.
 
-% The modes `no' and `oo' are allowed as synonyms, since some of the
-% literature uses this terminology.
+	% The modes `no' and `oo' are allowed as synonyms, since some of the
+	% literature uses this terminology.
+	%
 :- mode no == new >> old.
 :- mode oo == old >> old.
 
 %-----------------------------------------------------------------------------%
-
+%
 % PREDICATES.
-
+%
 % Most of these probably ought to be moved to another
 % module in the standard library such as std_util.m.
 
-% copy/2 makes a deep copy of a data structure.  The resulting copy is a
-% `unique' value, so you can use destructive update on it.
-
+	% copy/2 makes a deep copy of a data structure.  The resulting copy is
+	% a `unique' value, so you can use destructive update on it.
+	%
 :- pred copy(T, T).
 :- mode copy(ui, uo) is det.
 :- mode copy(in, uo) is det.
 
-% unsafe_promise_unique/2 is used to promise the compiler that you have a
-% `unique' copy of a data structure, so that you can use destructive update.
-% It is used to work around limitations in the current support for unique
-% modes.  `unsafe_promise_unique(X, Y)' is the same as `Y = X' except that
-% the compiler will assume that `Y' is unique.
-%
-% Note that misuse of this predicate may lead to unsound results:
-% if there is more than one reference to the data in question,
-% i.e. it is not `unique', then the behaviour is undefined.
-% (If you lie to the compiler, the compiler will get its revenge!)
-
+	% unsafe_promise_unique/2 is used to promise the compiler that you have
+	% a `unique' copy of a data structure, so that you can use destructive
+	% update.  It is used to work around limitations in the current support
+	% for unique modes.  `unsafe_promise_unique(X, Y)' is the same as `Y =
+	% X' except that the compiler will assume that `Y' is unique.
+	%
+	% Note that misuse of this predicate may lead to unsound results: if
+	% there is more than one reference to the data in question, i.e. it is
+	% not `unique', then the behaviour is undefined.  (If you lie to the
+	% compiler, the compiler will get its revenge!)
+	%
 :- pred unsafe_promise_unique(T, T).
 :- mode unsafe_promise_unique(in, uo) is det.
 
 :- func unsafe_promise_unique(T) = T.
 :- mode unsafe_promise_unique(in) = uo is det.
 
-% A synonym for fail/0; the name is more in keeping with Mercury's
-% declarative style rather than its Prolog heritage.
-
-:- pred false.
-:- mode false is failure.
+	% A synonym for fail/0; the name is more in keeping with Mercury's
+	% declarative style rather than its Prolog heritage.
+	%
+:- pred false is failure.
 
 %-----------------------------------------------------------------------------%
 
-% A call to the function `promise_only_solution(Pred)' constitutes a
-% promise on the part of the caller that `Pred' has at most one solution,
-% i.e. that `not some [X1, X2] (Pred(X1), Pred(X2), X1 \= X2)'.
-% `promise_only_solution(Pred)' presumes that this assumption is
-% satisfied, and returns the X for which Pred(X) is true, if
-% there is one.
-%
-% You can use `promise_only_solution' as a way of 
-% introducing `cc_multi' or `cc_nondet' code inside a
-% `det' or `semidet' procedure.
-%
-% Note that misuse of this function may lead to unsound results:
-% if the assumption is not satisfied, the behaviour is undefined.
-% (If you lie to the compiler, the compiler will get its revenge!)
-
+	% A call to the function `promise_only_solution(Pred)' constitutes a
+	% promise on the part of the caller that `Pred' has at most one
+	% solution, i.e. that `not some [X1, X2] (Pred(X1), Pred(X2), X1 \=
+	% X2)'.  `promise_only_solution(Pred)' presumes that this assumption is
+	% satisfied, and returns the X for which Pred(X) is true, if there is
+	% one.
+	%
+	% You can use `promise_only_solution' as a way of introducing
+	% `cc_multi' or `cc_nondet' code inside a `det' or `semidet' procedure.
+	%
+	% Note that misuse of this function may lead to unsound results: if the
+	% assumption is not satisfied, the behaviour is undefined.  (If you lie
+	% to the compiler, the compiler will get its revenge!)
+	%
 :- func promise_only_solution(pred(T)) = T.
 :- mode promise_only_solution(pred(out) is cc_multi) = out is det.
 :- mode promise_only_solution(pred(uo) is cc_multi) = uo is det.
 :- mode promise_only_solution(pred(out) is cc_nondet) = out is semidet.
 :- mode promise_only_solution(pred(uo) is cc_nondet) = uo is semidet.
 
-% `promise_only_solution_io' is like `promise_only_solution', but
-% for procedures with unique modes (e.g. those that do IO).
-%
-% A call to `promise_only_solution_io(P, X, IO0, IO)' constitutes
-% a promise on the part of the caller that for the given IO0,
-% there is only one value of `X' and `IO' for which `P(X, IO0, IO)' is true.
-% `promise_only_solution_io(P, X, IO0, IO)' presumes that this assumption
-% is satisfied, and returns the X and IO for which `P(X, IO0, IO)' is true.
-%
-% Note that misuse of this predicate may lead to unsound results:
-% if the assumption is not satisfied, the behaviour is undefined.
-% (If you lie to the compiler, the compiler will get its revenge!)
-
+	% `promise_only_solution_io' is like `promise_only_solution', but for
+	% procedures with unique modes (e.g. those that do IO).
+	%
+	% A call to `promise_only_solution_io(P, X, IO0, IO)' constitutes a
+	% promise on the part of the caller that for the given IO0, there is
+	% only one value of `X' and `IO' for which `P(X, IO0, IO)' is true.
+	% `promise_only_solution_io(P, X, IO0, IO)' presumes that this
+	% assumption is satisfied, and returns the X and IO for which `P(X,
+	% IO0, IO)' is true.
+	%
+	% Note that misuse of this predicate may lead to unsound results: if
+	% the assumption is not satisfied, the behaviour is undefined.  (If you
+	% lie to the compiler, the compiler will get its revenge!)
+	%
 :- pred promise_only_solution_io(pred(T, IO, IO), T, IO, IO).
 :- mode promise_only_solution_io(pred(out, di, uo) is cc_multi,
 		out, di, uo) is det.
@@ -192,12 +200,14 @@
 %-----------------------------------------------------------------------------%
 
 	% unify(X, Y) is true iff X = Y.
+	%
 :- pred unify(T::in, T::in) is semidet.
 
 	% For use in defining user-defined unification predicates.
 	% The relation defined by a value of type `unify', must be an
 	% equivalence relation; that is, it must be symmetric, reflexive,
 	% and transitive. 
+	%
 :- type unify(T) == pred(T, T).
 :- inst unify == (pred(in, in) is semidet).
 
@@ -206,6 +216,7 @@
 	% compare(Res, X, Y) binds Res to =, <, or >
 	% depending on whether X is =, <, or > Y in the
 	% standard ordering.
+	%
 :- pred compare(comparison_result, T, T).
 	% Note to implementors: the modes must appear in this order:
 	% compiler/higher_order.m depends on it, as does
@@ -231,6 +242,7 @@
 	%		ComparePred(R, X, Y), (R = (=) ; R = (>)).
 	%   must be total order relations: that is they must be antisymmetric,
 	%   reflexive and transitive.
+	%
 :- type compare(T) == pred(comparison_result, T, T).
 :- inst compare == (pred(uo, in, in) is det).
 
@@ -283,6 +295,7 @@
 	% = is an equivalence relation (not necessarily the usual equality),
 	% and the equivalence classes of this relation are totally ordered
 	% with respect to < and >.
+	%
 :- type comparison_pred(T) == pred(T, T, comparison_result).
 :- inst comparison_pred(I) == (pred(in(I), in(I), out) is det).
 :- inst comparison_pred == comparison_pred(ground).
Index: library/cord.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/cord.m,v
retrieving revision 1.3
diff -u -r1.3 cord.m
--- library/cord.m	26 Jan 2005 11:14:07 -0000	1.3
+++ library/cord.m	31 Jan 2005 03:32:49 -0000
@@ -26,7 +26,8 @@
 
 :- interface.
 
-:- import_module list, int.
+:- import_module int.
+:- import_module list.
 
     % Cords that contain the same members in the same order will not
     % necessarily have the same representation and will, therefore,
Index: library/float.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.61
diff -u -r1.61 float.m
--- library/float.m	12 Oct 2004 06:37:39 -0000	1.61
+++ library/float.m	31 Jan 2005 03:37:34 -0000
@@ -53,14 +53,17 @@
 %
 
 	% addition
+	%
 :- func float + float = float.
 :- mode in    + in    = uo  is det.
 
 	% subtraction
+	%
 :- func float - float = float.
 :- mode in    - in    = uo  is det.
 
 	% multiplication
+	%
 :- func float * float = float.
 :- mode in    * in    = uo  is det.
 
@@ -68,19 +71,23 @@
 	% Throws a `math__domain_error' exception if the right
 	% operand is zero. See the comments at the top of math.m
 	% to find out how to disable this check.
+	%
 :- func float / float = float.
 :- mode in    / in    = uo  is det.
 
 	% unchecked_quotient(X, Y) is the same as X / Y, but the
 	% behaviour is undefined if the right operand is zero.
+	%
 :- func unchecked_quotient(float, float) = float.
 :- mode unchecked_quotient(in, in)    = uo  is det.
 
 	% unary plus
+	%
 :- func + float = float.
 :- mode + in    = uo  is det.
 
 	% unary minus
+	%
 :- func - float = float.
 :- mode - in    = uo  is det.
 
@@ -88,43 +95,39 @@
 % Comparison predicates
 %
 
-	% less than
-:- pred <(float, float).
-:- mode <(in, in) is semidet.
-
-	% greater than
-:- pred >(float, float).
-:- mode >(in, in) is semidet.
-
-	% less than or equal
-:- pred =<(float, float).
-:- mode =<(in, in) is semidet.
-
-	% greater than or equal
-:- pred >=(float, float).
-:- mode >=(in, in) is semidet.
+	% less than, greater than, less than or equal, greater than or equal.
+	%
+:- pred (float::in)  < (float::in) is semidet.
+:- pred (float::in) =< (float::in) is semidet.
+:- pred (float::in) >= (float::in) is semidet.
+:- pred (float::in) >  (float::in) is semidet.
 
 %
 % Conversion functions
 %
 
 	% Convert int to float
+	%
 :- func float(int) = float.
 
 	% ceiling_to_int(X) returns the
 	% smallest integer not less than X.
+	%
 :- func ceiling_to_int(float) = int.
 
 	% floor_to_int(X) returns the
 	% largest integer not greater than X.
+	%
 :- func floor_to_int(float) = int.
 
 	% round_to_int(X) returns the integer closest to X.
 	% If X has a fractional value of 0.5, it is rounded up.
+	%
 :- func round_to_int(float) = int.
 
 	% truncate_to_int(X) returns 
 	% the integer closest to X such that |truncate_to_int(X)| =< |X|.
+	%
 :- func truncate_to_int(float) = int.
 
 %
@@ -132,30 +135,38 @@
 %
 
 	% absolute value
+	%
 :- func abs(float) = float.
 
 	% maximum
+	%
 :- func max(float, float) = float.
 
 	% minimum
+	%
 :- func min(float, float) = float.
 
 	% pow(Base, Exponent) returns Base raised to the power Exponent.
 	% Fewer domain restrictions than math__pow: works for negative Base,
 	% and float__pow(B, 0) = 1.0 for all B, even B=0.0.
 	% Only pow(0, <negative>) throws a `math__domain_error' exception.
+	%
 :- func pow(float, int) = float.
 
 	% Compute a non-negative integer hash value for a float.
+	%
 :- func hash(float) = int.
 
 	% Is the float point number not a number or infinite?
+	%
 :- pred is_nan_or_inf(float::in) is semidet.
 
 	% Is the floating point number not a number?
+	%
 :- pred is_nan(float::in) is semidet.
 
 	% Is the floating point number infinite?
+	%
 :- pred is_inf(float::in) is semidet.
 
 %
@@ -179,6 +190,7 @@
 	% consecutive floating point numbers.
 	%
 	% epsilon = radix ** (1 - mantissa_digits)
+	%
 :- func float__epsilon = float.
 
 	% Radix of the floating-point representation.
Index: library/graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.22
diff -u -r1.22 graph.m
--- library/graph.m	26 May 2003 09:00:29 -0000	1.22
+++ library/graph.m	31 Jan 2005 03:38:48 -0000
@@ -23,6 +23,7 @@
 	% graph(Node, Arc) represents a directed graph with information of
 	% type Node associated with each node, and information of type Arc
 	% associated with each arc.
+	%
 :- type graph(N, A).
 
 :- type node(N).
@@ -31,6 +32,7 @@
 
 	% Lots of graphs don't need to store anything in the arcs so here's
 	% a type equivalence that only has `real' information in the nodes.
+	%
 :- type graph(N)	== graph(N, unit).
 
 :- type arc		== arc(unit).
@@ -41,6 +43,7 @@
 	% it is possible for a graph to contain no nodes or arcs
 	% and still fail to unify with the binding of Graph from
 	% graph__init.)
+	%
 :- pred graph__init(graph(N, A)).
 :- mode graph__init(out) is det.
 
@@ -55,6 +58,7 @@
 	% same information stored in them.
 	%
 	% This operation is O(lgN) for a graph containing N nodes.
+	%
 :- pred graph__set_node(graph(N, A), N, node(N), graph(N, A)).
 :- mode graph__set_node(in, in, out, out) is det.
 
@@ -65,11 +69,13 @@
 	% This operation is O(N) for a graph containing N nodes since
 	% this predicate has to check that the node data isn't in an
 	% existing node.
+	%
 :- pred graph__insert_node(graph(N, A), N, node(N), graph(N, A)).
 :- mode graph__insert_node(in, in, out, out) is semidet.
 
 	% graph__det_insert_node/4 is like graph__insert_node, except
 	% that if the insertion would fail, it calls error/1.
+	%
 :- pred graph__det_insert_node(graph(N, A), N, node(N), graph(N, A)).
 :- mode graph__det_insert_node(in, in, out, out) is det.
 
@@ -79,6 +85,7 @@
 	%
 	% This operation is O(lgN) for the first solution for a graph
 	% containing N nodes.
+	%
 :- pred graph__search_node(graph(N, A), N, node(N)).
 :- mode graph__search_node(in, in, out) is nondet.
 
@@ -88,6 +95,7 @@
 	% Nodes will of course be empty if there are no matching nodes.)
 	%
 	% This operation is O(NlgN) for a graph containing N nodes.
+	%
 :- pred graph__find_matching_nodes(graph(N, A), N, set(node(N))).
 :- mode graph__find_matching_nodes(in, in, out) is det.
 
@@ -97,6 +105,7 @@
 	% Node and returns the information NodeInfo stored in Node.
 	%
 	% This operation is O(lgN) for a graph containing N nodes.
+	%
 :- pred graph__node_contents(graph(N, A), node(N), N).
 :- mode graph__node_contents(in, in, out) is det.
 
@@ -107,12 +116,14 @@
 	% (directly - not transitively) from Node.
 	%
 	% This operation is O(NlgN) for a graph containing N nodes.
+	%
 :- pred graph__successors(graph(N, A), node(N), set(node(N))).
 :- mode graph__successors(in, in, out) is det.
 
 :- func graph__successors(graph(N, A), node(N)) = set(node(N)).
 
 	% graph__nodes(Graph, Nodes) binds Nodes to the set of nodes in Graph.
+	%
 :- pred graph__nodes(graph(N, A), set(node(N))).
 :- mode graph__nodes(in, out) is det.
 
@@ -126,6 +137,7 @@
 	% no effect.
 	%
 	% This operation is O(lgN+lgM) for a graph with N nodes and M arcs.
+	%
 :- pred graph__set_edge(graph(N, A), node(N), node(N), A,
 						arc(A), graph(N, A)).
 :- mode graph__set_edge(in, in, in, in, out, out) is det.
@@ -133,12 +145,14 @@
 	% graph__insert_edge/6 is the same as graph__set_edge/6 except that
 	% if an identical arc already exists in the graph the operation fails.
 	% This is O(N) for a graph with N edges between the two nodes.
+	%
 :- pred graph__insert_edge(graph(N, A), node(N), node(N), A,
 						arc(A), graph(N, A)).
 :- mode graph__insert_edge(in, in, in, in, out, out) is semidet.
 
 	% graph__det_insert_edge/6 is like graph__insert_edge except
 	% than instead of failing, it calls error/1.
+	%
 :- pred graph__det_insert_edge(graph(N, A), node(N), node(N), A,
 						arc(A), graph(N, A)).
 :- mode graph__det_insert_edge(in, in, in, in, out, out) is det.
@@ -146,6 +160,7 @@
 	% graph__arc_contents(Graph, Arc, Start, End, ArcInfo) takes a
 	% graph Graph and an arc Arc and returns the start and end nodes
 	% and the information stored in that arc.
+	%
 :- pred graph__arc_contents(graph(N, A), arc(A), node(N), node(N), A).
 :- mode graph__arc_contents(in, in, out, out, out) is det.
 
@@ -153,6 +168,7 @@
 	% from the node Start to the node End in Graph that goes through
 	% the sequence of arcs Arcs.
 	% The algorithm will return paths containing at most one cycle.
+	%
 :- pred graph__path(graph(N, A), node(N), node(N), list(arc(A))).
 :- mode graph__path(in, in, in, out) is nondet.
 :- mode graph__path(in, in, out, out) is nondet.
Index: library/group.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/group.m,v
retrieving revision 1.20
diff -u -r1.20 group.m
--- library/group.m	26 May 2003 09:00:29 -0000	1.20
+++ library/group.m	31 Jan 2005 03:39:31 -0000
@@ -6,7 +6,7 @@
 %
 % file: group.m.
 % main author: conway.
-% stability: low.
+% stability: low (obsolete).
 %
 % This module is probably not terribly useful, and it may not be supported
 % in future releases.
Index: library/hash_table.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/hash_table.m,v
retrieving revision 1.8
diff -u -r1.8 hash_table.m
--- library/hash_table.m	15 Mar 2004 23:49:31 -0000	1.8
+++ library/hash_table.m	31 Jan 2005 06:36:51 -0000
@@ -118,6 +118,10 @@
 :- func set(hash_table(K, V), K, V) = hash_table(K, V).
 :- mode set(hash_table_di, in, in) = hash_table_uo is det.
 
+:- pred set(K::in, V::in,
+        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
+        is det.
+
     % Field update for hash tables.
     % HT ^ elem(K) := V  is equivalent to  set(HT, K, V).
     %
@@ -131,6 +135,10 @@
 :- func det_insert(hash_table(K, V), K, V) = hash_table(K, V).
 :- mode det_insert(hash_table_di, in, in) = hash_table_uo is det.
 
+:- pred det_insert(K::in, V::in,
+        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
+        is det.
+
     % Change a key-value binding in a hash table.  An
     % exception is thrown if a binding for the key does not
     % already exist.
@@ -138,12 +146,20 @@
 :- func det_update(hash_table(K, V), K, V) = hash_table(K, V).
 :- mode det_update(hash_table_di, in, in) = hash_table_uo is det.
 
+:- pred det_update(K::in, V::in,
+        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
+        is det.
+
     % Delete the entry for the given key, leaving the hash table
     % unchanged if there is no such entry.
     %
 :- func delete(hash_table(K, V), K) = hash_table(K, V).
 :- mode delete(hash_table_di, in) = hash_table_uo is det.
 
+:- pred delete(K::in, 
+        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
+        is det.
+
     % Lookup the value associated with the given key.  An exception
     % is raised if there is no entry for the key.
     %
@@ -174,6 +190,11 @@
 :- mode to_assoc_list(hash_table_ui) = out is det.
 %:- mode to_assoc_list(in) = out is det.
 
+    % Convert an association list into a hash table.
+    %
+:- func from_assoc_list(hash_pred(K)::in(hash_pred), assoc_list(K, V)::in) =
+        (hash_table(K, V)::hash_table_uo) is det.
+
     % Fold a function over the key-value bindings in a hash table.
     %
 :- func fold(func(K, V, T) = T, hash_table(K, V), T) = T.
@@ -197,7 +218,7 @@
                 values                  :: array(V)
             ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % THE HASHING SCHEME
     %
@@ -226,7 +247,7 @@
     % least one binding is inserted.  This is handled by checking
     % to see whether the keys array has non-zero size.
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 new(HashPred, N, MaxOccupancy) = HT :-
     (      if N =< 1 then
@@ -243,16 +264,17 @@
             Bitmap       = bitmap__new(NumBuckets, no),
             Keys         = array__make_empty_array,
             Values       = array__make_empty_array,
-            HT = ht(NumBuckets, 0, MaxOccupants, HashPred, Bitmap, Keys, Values)
+            HT           = ht(NumBuckets, 0, MaxOccupants, HashPred, Bitmap,
+                                Keys, Values)
     ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % These numbers are picked out of thin air.
     %
 new_default(HashPred) = new(HashPred, 7, 0.9).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % find_slot(HT, K) looks up key K in hash table HT and
     % returns the index for the entry K in H.  This is either the
@@ -289,7 +311,7 @@
         H  = find_slot_2(HT, K, H1, Delta)
     ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 set(HT0, K, V) = HT :-
 
@@ -315,7 +337,7 @@
                   else
                     (((( HT0
                             ^ num_occupants    := HT0 ^ num_occupants + 1 )
-                            ^ bitmap           := bitmap__set(HT0 ^ bitmap, H) )
+                            ^ bitmap           := bitmap__set(HT0 ^ bitmap, H))
                             ^ keys ^ elem(H)   := K )
                             ^ values ^ elem(H) := V )
                 )
@@ -324,7 +346,9 @@
 
 'elem :='(K, HT, V) = set(HT, K, V).
 
-% ---------------------------------------------------------------------------- %
+set(K, V, HT, HT ^ elem(K) := V).
+
+%-----------------------------------------------------------------------------%
 
 search(HT, K, search(HT, K)).
 
@@ -333,7 +357,7 @@
     bitmap__is_set(HT ^ bitmap, H),
     V = HT ^ values ^ elem(H).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 det_insert(HT0, K, V) = HT :-
     H = find_slot(HT0, K),
@@ -355,7 +379,10 @@
                 ^ values ^ elem(H) := V )
     ).
 
-% ---------------------------------------------------------------------------- %
+
+det_insert(K, V, HT, det_insert(HT, K, V)).
+
+%-----------------------------------------------------------------------------%
 
 det_update(HT0, K, V) = HT :-
     H = find_slot(HT0, K),
@@ -365,7 +392,10 @@
         HT = HT0 ^ values ^ elem(H) := V
     ).
 
-% ---------------------------------------------------------------------------- %
+
+det_update(K, V, HT, det_update(HT, K, V)).
+
+%-----------------------------------------------------------------------------%
 
 lookup(HT, K) =
     ( if V = search(HT, K)
@@ -375,12 +405,15 @@
 
 elem(K, HT) = lookup(HT, K).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 delete(HT, K) =
     HT ^ bitmap := bitmap__clear(HT ^ bitmap, find_slot(HT, K)).
 
-% ---------------------------------------------------------------------------- %
+
+delete(K, HT, delete(HT, K)).
+
+%-----------------------------------------------------------------------------%
 
 to_assoc_list(HT) = to_assoc_list_2(0, HT, []).
 
@@ -398,7 +431,19 @@
             [(HT ^ keys ^ elem(I)) - (HT ^ values ^ elem(I)) | AList])
     ).
 
-% ---------------------------------------------------------------------------- %
+
+from_assoc_list(HP, AList) = from_assoc_list_2(AList, new_default(HP)).
+
+:- func from_assoc_list_2(assoc_list(K, V)::in,
+        hash_table(K, V)::hash_table_di) = (hash_table(K, V)::hash_table_uo)
+        is det.
+
+from_assoc_list_2([], HT) = HT.
+
+from_assoc_list_2([K - V | AList], HT) =
+    from_assoc_list_2(AList, HT ^ elem(K) := V).
+
+%-----------------------------------------------------------------------------%
 
     % Hash tables expand by doubling in size.
     %
@@ -419,7 +464,7 @@
 
     HT  = reinsert_bindings(0, NBs0, BM0, Ks0, Vs0, HT1).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 :- func reinsert_bindings(int, int, bitmap, array(K), array(V),
     hash_table(K, V)) = hash_table(K, V).
@@ -436,7 +481,7 @@
             set(HT, Keys ^ elem(I), Values ^ elem(I)))
     ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % There are almost certainly better ones out there...
     %
@@ -447,7 +492,7 @@
     H1 = N * N,
     H2 = N `xor` (N + N).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % There are almost certainly better ones out there...
     %
@@ -455,7 +500,7 @@
     H1 = string__hash(S),
     H2 = string__foldl(func(C, N) = char__to_int(C) + N, S, 0).
 
-%------------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 
     % There are almost certainly better ones out there...
     %
@@ -463,14 +508,14 @@
     H1 = float__hash(F),
     H2 = float__hash(F * F).
 
-%------------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 
     % There are almost certainly better ones out there...
     %
 char_double_hash(C, H1, H2) :-
     int_double_hash(char__to_int(C), H1, H2).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % This, again, is straight off the top of my head.
     %
@@ -523,7 +568,7 @@
         )
     ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 :- func munge_factor_a = int.
 
@@ -547,13 +592,15 @@
     (X `unchecked_right_shift` (int__bits_per_int - N)) `xor`
     Y.
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 fold(Fn, HT, X) = fold_0(0, Fn, HT, X).
 
 :- func fold_0(int, func(K, V, T) = T, hash_table(K,V), T) = T.
-:- mode fold_0(in, func(in,in,in) = out is det, hash_table_ui, in) = out is det.
-:- mode fold_0(in, func(in,in,di) = uo is det, hash_table_ui, di) = uo is det.
+:- mode fold_0(in, func(in,in,in) = out is det, hash_table_ui, in) = out
+        is det.
+:- mode fold_0(in, func(in,in,di) = uo is det, hash_table_ui, di) = uo
+        is det.
 % :- mode fold_0(in, func(in,in,in) = out is det, in, in) = out is det.
 % :- mode fold_0(in, func(in,in,di) = uo is det, in, di) = uo is det.
 
@@ -563,10 +610,11 @@
       else if bitmap__is_clear(HT ^ bitmap, I) then
         fold_0(I + 1, Fn, HT, X)
       else
-        fold_0(I + 1, Fn, HT, Fn(HT ^ keys ^ elem(I), HT ^ values ^ elem(I), X))
+        fold_0(I + 1, Fn, HT,
+            Fn(HT ^ keys ^ elem(I), HT ^ values ^ elem(I), X))
     ).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
     % XXX To go into array.m
     %
@@ -591,5 +639,5 @@
         %
     dynamic_cast(X, A `with_type` array(ArgType)).
 
-% ---------------------------------------------------------------------------- %
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
Index: library/int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.101
diff -u -r1.101 int.m
--- library/int.m	27 Jan 2005 03:59:26 -0000	1.101
+++ library/int.m	31 Jan 2005 03:53:05 -0000
@@ -26,39 +26,38 @@
 
 :- instance enum(int).
 
-	% less than
-:- pred int < int.
-:- mode in  < in is semidet.
-
-	% greater than
-:- pred int > int.
-:- mode in  > in is semidet.
-
-	% less than or equal
-:- pred int =< int.
-:- mode in  =< in is semidet.
-
-	% greater than or equal
-:- pred int >= int.
-:- mode in >= in is semidet.
+%
+% Comparison.
+%
+
+	% less than, less than or equal, greater than or equal, greater than.
+	%
+:- pred (int::in)  < (int::in) is semidet.
+:- pred (int::in) =< (int::in) is semidet.
+:- pred (int::in) >= (int::in) is semidet.
+:- pred (int::in) >  (int::in) is semidet.
 
 	% absolute value
+	%
 :- func int__abs(int) = int.
 :- pred int__abs(int, int).
 :- mode int__abs(in, out) is det.
 
 	% maximum
+	%
 :- func int__max(int, int) = int.
 :- pred int__max(int, int, int).
 :- mode int__max(in, in, out) is det.
 
 	% minimum
+	%
 :- func int__min(int, int) = int.
 :- pred int__min(int, int, int).
 :- mode int__min(in, in, out) is det.
 
 	% conversion of integer to floating point
 	% OBSOLETE: use float__float/1 instead.
+	%
 :- pragma obsolete(int.to_float/2).
 :- pred int__to_float(int, float) is det.
 :- mode int__to_float(in, out) is det.
@@ -66,6 +65,7 @@
 	% exponentiation
 	% int__pow(X, Y, Z): Z is X raised to the Yth power
 	% Throws a `math__domain_error' exception if Y is negative.
+	%
 :- func int__pow(int, int) = int.
 :- pred int__pow(int, int, int).
 :- mode int__pow(in, in, out) is det.
@@ -74,29 +74,26 @@
 	% int__log2(X) = N is the least integer such that 2 to the
 	% power N is greater than or equal to X.
 	% Throws a `math__domain_error' exception if X is not positive.
+	%
 :- func int__log2(int) = int.
 :- pred int__log2(int, int).
 :- mode int__log2(in, out) is det.
 
 	% addition
+	%
 :- func int + int = int.
-:- mode in  + in  = uo  is det.
-:- mode uo  + in  = in  is det.
-:- mode in  + uo  = in  is det.
 
 :- func int__plus(int, int) = int.
 
 	% multiplication
+	%
 :- func int * int = int.
-:- mode in  * in  = uo  is det.
 
 :- func int__times(int, int) = int.
 
 	% subtraction
+	%
 :- func int - int = int.
-:- mode in  - in  = uo  is det.
-:- mode uo  - in  = in  is det.
-:- mode in  - uo  = in  is det.
 
 :- func int__minus(int, int) = int.
 
@@ -106,8 +103,8 @@
 	% Throws a `math__domain_error' exception if the right operand
 	% is zero. See the comments at the top of math.m to find out how to
 	% disable domain checks.
+	%
 :- func div(int, int) = int.
-:- mode div(in, in) = uo is det.
 
 	% truncating integer division
 	% Truncates towards zero, e.g. (-10) // 3 = (-3).
@@ -117,24 +114,23 @@
 	% Throws a `math__domain_error' exception if the right operand
 	% is zero. See the comments at the top of math.m to find out how to
 	% disable domain checks.
+	%
 :- func int // int = int.
-:- mode in  // in  = uo  is det.
 
 	% (/)/2 is a synonym for (//)/2 to bring Mercury into line with
 	% the common convention for naming integer division.
 	%
 :- func int / int = int.
-:- mode in  / in  = uo  is det.
 
 	% unchecked_quotient(X, Y) is the same as X // Y, but the
 	% behaviour is undefined if the right operand is zero.
+	%
 :- func unchecked_quotient(int, int) = int.
-:- mode unchecked_quotient(in, in)  = uo  is det.
 
 	% modulus
 	% X mod Y = X - (X div Y) * Y
+	%
 :- func int mod int = int.
-:- mode in  mod in  = uo  is det.
 
 	% remainder
 	% X rem Y = X - (X // Y) * Y
@@ -144,93 +140,96 @@
 	% Throws a `math__domain_error' exception if the right operand
 	% is zero. See the comments at the top of math.m to find out how to
 	% disable domain checks.
+	%
 :- func int rem int = int.
-:- mode in rem in = uo is det.
 
 	% unchecked_rem(X, Y) is the same as X rem Y, but the
 	% behaviour is undefined if the right operand is zero.
+	%
 :- func unchecked_rem(int, int) = int.
-:- mode unchecked_rem(in, in) = uo is det.
 
 	% Left shift.
 	% X << Y returns X "left shifted" by Y bits. 
 	% To be precise, if Y is negative, the result is
 	% X div (2^(-Y)), otherwise the result is X * (2^Y).
+	%
 :- func int << int = int.
-:- mode in  << in  = uo  is det.
 
 	% unchecked_left_shift(X, Y) is the same as X << Y
 	% except that the behaviour is undefined if Y is negative,
 	% or greater than or equal to the result of `int__bits_per_int/1'.
 	% It will typically be implemented more efficiently than X << Y.
+	%
 :- func unchecked_left_shift(int, int) = int.
-:- mode unchecked_left_shift(in, in) = uo is det.
 
 	% Right shift.
 	% X >> Y returns X "arithmetic right shifted" by Y bits.
 	% To be precise, if Y is negative, the result is
 	% X * (2^(-Y)), otherwise the result is X div (2^Y).
+	%
 :- func int >> int = int.
-:- mode in  >> in  = uo  is det.
 
 	% unchecked_right_shift(X, Y) is the same as X >> Y
 	% except that the behaviour is undefined if Y is negative,
 	% or greater than or equal to the result of `int__bits_per_int/1'.
 	% It will typically be implemented more efficiently than X >> Y.
+	%
 :- func unchecked_right_shift(int, int) = int.
-:- mode unchecked_right_shift(in, in) = uo is det.
 
 	% even(X) is equivalent to (X mod 2 = 0).
+	%
 :- pred even(int).
 :- mode even(in) is semidet.
 
 	% odd(X) is equivalent to (not even(X)), i.e. (X mod 2 = 1).
+	%
 :- pred odd(int).
 :- mode odd(in) is semidet.
 
 	% bitwise and
+	%
 :- func int /\ int = int.
-:- mode in  /\ in  = uo  is det.
 
 	% bitwise or
+	%
 :- func int \/ int = int.
-:- mode in  \/ in  = uo  is det.
 
 	% bitwise exclusive or (xor)
+	%
 :- func int__xor(int, int) = int.
-:- mode int__xor(in, in) = uo is det.
-:- mode int__xor(in, uo) = in is det.
-:- mode int__xor(uo, in) = in is det.
 
 	% bitwise complement
+	%
 :- func \ int = int.
-:- mode \ in  = uo  is det.
 
 	% unary plus
+	%
 :- func + int = int.
-:- mode + in = uo is det.
 
 	% unary minus
+	%
 :- func - int = int.
-:- mode - in = uo is det.
 
 	% is/2, for backwards compatibility with Prolog (and with
+	%
 :- pred is(T, T) is det.
-:- 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.
+	%
 :- 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.
+	%
 :- 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.
+	%
 :- func int__bits_per_int = int.
 :- pred int__bits_per_int(int::out) is det.
 
@@ -351,9 +350,11 @@
 	% here to make sure they go in the `.opt' file.
 
 	% int__quot_bits_per_int(X) = X // bits_per_int.		
+	%
 :- func int__quot_bits_per_int(int) = int.
 
 	% int__times_bits_per_int(X) = X * bits_per_int.		
+	%
 :- func int__times_bits_per_int(int) = int.
 
 	% Used by bitmap.m.  Like the ones above, the purpose of
@@ -361,6 +362,7 @@
 	% this can be optimized.
 
 	% int__rem_bits_per_int(X) = X `rem` bits_per_int.		
+	%
 :- func int__rem_bits_per_int(int) = int.
 
 %-----------------------------------------------------------------------------%
Index: library/lexer.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/lexer.m,v
retrieving revision 1.39
diff -u -r1.39 lexer.m
--- library/lexer.m	15 Mar 2004 06:50:15 -0000	1.39
+++ library/lexer.m	31 Jan 2005 04:04:02 -0000
@@ -48,12 +48,14 @@
 					% integer_dot/1 tokens to integer/1
 					% tokens before returning them.
 
-% For every token, we record the line number of the line on
-% which the token occurred.
-
+	% For every token, we record the line number of the line on
+	% which the token occurred.
+	%
 :- type token_context == int.	% line number
 
-% This "fat list" representation is more efficient than a list of pairs.
+	% This "fat list" representation is more efficient than a list of
+	% pairs.
+	%
 :- type token_list
 	--->	token_cons(token, token_context, token_list)
 	;	token_nil.
@@ -61,10 +63,11 @@
 	% Read a list of tokens from the current input stream.
 	% Keep reading until we encounter either an `end' token
 	% (i.e. a full stop followed by whitespace) or the end-of-file.
-
+	%
 :- pred lexer__get_token_list(token_list::out, io::di, io::uo) is det.
 
-% The type `offset' represents a (zero-based) offset into a string.
+	% The type `offset' represents a (zero-based) offset into a string.
+	%
 :- type offset == int.
 
 	% lexer__string_get_token_list(String, MaxOffset, Tokens,
@@ -76,16 +79,18 @@
 	% we reach MaxOffset.  (MaxOffset must be =< the length of the string.)
 	% Return the tokens scanned in Tokens, and return the position
 	% one character past the end of the last token in FinalPos.
-
+	%
 :- pred lexer__string_get_token_list(string::in, offset::in, token_list::out,
 	posn::in, posn::out) is det.
 
 	% lexer__string_get_token_list(String, Tokens, InitialPos, FinalPos):
 	% calls string_get_token_list/5 above with MaxPos = length of String.
+	%
 :- pred lexer__string_get_token_list(string::in, token_list::out,
 	posn::in, posn::out) is det.
 
 	% Convert a token to a human-readable string describing the token.
+	%
 :- pred lexer__token_to_string(token::in, string::out) is det.
 
 %-----------------------------------------------------------------------------%
Index: library/list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.129
diff -u -r1.129 list.m
--- library/list.m	6 Jan 2005 05:08:15 -0000	1.129
+++ library/list.m	31 Jan 2005 06:24:33 -0000
@@ -23,7 +23,6 @@
 	%	or an element `Head' of type `T' followed by a tail `Tail'
 	%	of type `list(T)', denoted `[Head | Tail]'.
 	%
-
 :- type list(T) ---> [] ; [T | list(T)].
 
 %-----------------------------------------------------------------------------%
@@ -105,11 +104,13 @@
 	% list__remove_suffix(List, Suffix, Prefix):
 	%	The same as list__append(Prefix, Suffix, List) except that
 	%	this is semidet whereas list__append(out, in, in) is nondet.
+	%
 :- pred list__remove_suffix(list(T)::in, list(T)::in, list(T)::out) is semidet.
 
 	% list__merge(L1, L2, L):
 	%	L is the result of merging the elements of L1 and L2,
 	%	in ascending order.  L1 and L2 must be sorted.
+	%
 :- pred list__merge(list(T)::in, list(T)::in, list(T)::out) is det.
 :- func list__merge(list(T), list(T)) = list(T).
 
@@ -118,6 +119,7 @@
 	%	in ascending order, and eliminating any duplicates.
 	%	L1 and L2 must be sorted and must each not contain any
 	%	duplicates.
+	%
 :- pred list__merge_and_remove_dups(list(T)::in, list(T)::in, list(T)::out)
 	is det.
 :- func list__merge_and_remove_dups(list(T), list(T)) = list(T).
@@ -125,17 +127,20 @@
 	% list__remove_adjacent_dups(L0, L) :
 	%	L is the result of replacing every sequence of duplicate
 	%	elements in L0 with a single such element.
+	%
 :- pred list__remove_adjacent_dups(list(T)::in, list(T)::out) is det.
 :- func list__remove_adjacent_dups(list(T)) = list(T).
 
 	% list__remove_dups(L0, L) :
 	%	L is the result of deleting the second and subsequent
 	%	occurrences of every element that occurs twice in L0.
+	%
 :- pred list__remove_dups(list(T)::in, list(T)::out) is det.
 :- func list__remove_dups(list(T)) = list(T).
 
 	% list__member(Elem, List) :
 	%	True iff `List' contains `Elem'.
+	%
 :- pred list__member(T, list(T)).
 :- mode list__member(in, in) is semidet.
 :- mode list__member(out, in) is nondet.
@@ -276,6 +281,8 @@
 	is det.
 :- func list__replace_nth_det(list(T), int, T) = list(T).
 
+:- func list__det_replace_nth(list(T), int, T) = list(T).
+
 	% list__sort_and_remove_dups(List0, List):
 	%	List is List0 sorted with the second and subsequent
 	%	occurrence of any duplicates removed.
@@ -323,6 +330,8 @@
 
 :- func list__index0_det(list(T), int) = T.
 :- func list__index1_det(list(T), int) = T.
+:- func list__det_index0(list(T), int) = T.
+:- func list__det_index1(list(T), int) = T.
 
 	% list__zip(ListA, ListB, List):
 	%	List is the result of alternating the elements
@@ -363,28 +372,37 @@
 	% list__sublist(SubList, FullList) is true
 	%	if one can obtain SubList by starting with FullList
 	%	and deleting some of its elements.
+	%
 :- pred list__sublist(list(T)::in, list(T)::in) is semidet.
 
 	% list__all_same(List) is true
 	% 	if all elements of the list are the same
+	%
 :- pred list__all_same(list(T)::in) is semidet.
 
 	% list__last(List, Last) is true
 	%	if Last is the last element of List.
+	%
 :- pred list__last(list(T)::in, T::out) is semidet.
 
 	% A deterministic version of list__last, which aborts instead of
 	% failing if the input list is empty.
+	%
 :- pred list__last_det(list(T)::in, T::out) is det.
+:- pred list__det_last(list(T)::in, T::out) is det.
+:- func list__det_last(list(T)) = T.
 
 	% list__split_last(List, AllButLast, Last) is true
 	%	if Last is the last element of List and AllButLast is the list
 	%	of elements before it.
+	%
 :- pred list__split_last(list(T)::in, list(T)::out, T::out) is semidet.
 
 	% A deterministic version of list__split_last, which aborts instead of
 	% failing if the input list is empty.
+	%
 :- pred list__split_last_det(list(T)::in, list(T)::out, T::out) is det.
+:- pred list__det_split_last(list(T)::in, list(T)::out, T::out) is det.
 
 %-----------------------------------------------------------------------------%
 %
@@ -863,7 +881,7 @@
 :- mode list__series(in, pred(in) is semidet, func(in) = out is det) = out
 	is det.
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 	% Lo `..` Hi = [Lo, Lo + 1, ..., Hi] if Lo =< Hi
 	%            =                    [] otherwise
@@ -872,16 +890,22 @@
 
 %-----------------------------------------------------------------------------%
 
+:- func list__head(list(T)) = T is semidet.
+
+:- func list__tail(list(T)) = list(T) is semidet.
+
 	% list__det_head(List) returns the first element of List,
 	% calling error/1 if List is empty.
+	%
 :- func list__det_head(list(T)) = T.
 
 	% list__det_tail(List) returns the tail of List,
 	% calling error/1 if List is empty.
+	%
 :- func list__det_tail(list(T)) = list(T).
 
-% ---------------------------------------------------------------------------- %
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 
 :- implementation.
 
@@ -912,7 +936,7 @@
 
 :- implementation.
 
-:- import_module string, bintree_set, require, std_util.
+:- import_module string, set_tree234, require, std_util.
 
 %-----------------------------------------------------------------------------%
 
@@ -1183,18 +1207,17 @@
 %-----------------------------------------------------------------------------%
 
 list__remove_dups(Xs, Ys) :-
-	bintree_set__init(Zs0),
-	list__remove_dups_2(Xs, Zs0, Ys).
+	list__remove_dups_2(Xs, set_tree234__init, Ys).
 
-:- pred list__remove_dups_2(list(T)::in, bintree_set(T)::in, list(T)::out)
+:- pred list__remove_dups_2(list(T)::in, set_tree234(T)::in, list(T)::out)
 	is det.
 
 list__remove_dups_2([], _SoFar, []).
 list__remove_dups_2([X | Xs], SoFar0, Zs) :-
-	( bintree_set__member(X, SoFar0) ->
+	( set_tree234__member(SoFar0, X) ->
 		list__remove_dups_2(Xs, SoFar0, Zs)
 	;
-		bintree_set__insert(SoFar0, X, SoFar),
+		set_tree234__insert(X, SoFar0, SoFar),
 		list__remove_dups_2(Xs, SoFar, Ys),
 		Zs = [X | Ys]
 	).
@@ -1351,6 +1374,12 @@
 		error("list__last_det: empty list")
 	).
 
+list__det_last(List, Last) :-
+	list__last_det(List, Last).
+
+list__det_last(List) = Last :-
+	list__last_det(List, Last).
+
 list__split_last([H | T], AllButLast, Last) :-
 	(
 		T = [],
@@ -1370,6 +1399,9 @@
 		error("list__split_last_det: empty list")
 	).
 
+list__det_split_last(List, AllButLast, Last) :-
+	list__split_last_det(List, AllButLast, Last).
+
 %-----------------------------------------------------------------------------%
 
 list__map(_, [],  []).
@@ -1699,6 +1731,10 @@
 	error("list__det_tail/1: empty list as argument").
 list__det_tail([_ | Xs]) = Xs.
 
+list__head([X | _]) = X.
+
+list__tail([_ | Xs]) = Xs.
+
 list__append(Xs, Ys) = Zs :-
 	list__append(Xs, Ys, Zs).
 
@@ -1732,6 +1768,9 @@
 list__replace_nth_det(Xs, N, A) = Ys :-
 	list__replace_nth_det(Xs, N, A, Ys).
 
+list__det_replace_nth(Xs, N, A) = Ys :-
+	list__replace_nth_det(Xs, N, A, Ys).
+
 list__sort_and_remove_dups(Xs) = Ys :-
 	list__sort_and_remove_dups(Xs, Ys).
 
@@ -1744,9 +1783,15 @@
 list__index0_det(Xs, N) = A :-
 	list__index0_det(Xs, N, A).
 
+list__det_index0(Xs, N) = A :-
+	list__index0_det(Xs, N, A).
+
 list__index1_det(Xs, N) = A :-
 	list__index1_det(Xs, N, A).
 
+list__det_index1(Xs, N) = A :-
+	list__index1_det(Xs, N, A).
+
 list__zip(Xs, Ys) = Zs :-
 	list__zip(Xs, Ys, Zs).
 
@@ -1790,11 +1835,11 @@
 	P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
 	list__merge_and_remove_dups(P, Xs, Ys, Zs).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 L1 ++ L2 = list__append(L1, L2).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 list__series(I, OK, Succ) =
 	( OK(I) ->
@@ -1803,10 +1848,10 @@
 	  	[]
 	).
 
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
 
 Lo `..` Hi =
 	list__series(Lo, ( pred(I::in) is semidet :- I =< Hi ), plus(1)).
 
-% ---------------------------------------------------------------------------- %
-% ---------------------------------------------------------------------------- %
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
Index: library/map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.95
diff -u -r1.95 map.m
--- library/map.m	24 Jan 2005 23:16:37 -0000	1.95
+++ library/map.m	31 Jan 2005 04:14:05 -0000
@@ -71,34 +71,42 @@
 	% Search for a key-value pair using the key.  If there is no entry
 	% for the given key, returns the pair for the next higher key instead.
 	% Fails if there is no key with the given or higher value.
+	%
 :- pred map__upper_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 higher key instead.
 	% Aborts if there is no key with the given or higher value.
+	%
 :- pred map__upper_bound_lookup(map(K, V)::in, K::in, K::out, V::out) is det.
 
 	% Return the largest key in the map, if there is one.
+	%
 :- func map__max_key(map(K,V)) = K is semidet.
 
 	% Return the smallest key in the map, if there is one.
+	%
 :- func map__min_key(map(K,V)) = K is semidet.
 
 	% Search map for data.
+	%
 :- pred map__inverse_search(map(K, V)::in, V::in, K::out) is nondet.
 
 	% Insert a new key and corresponding value into a map.
 	% Fail if the key already exists.
+	%
 :- pred map__insert(map(K, V)::in, K::in, V::in, map(K, V)::out) is semidet.
 :- func map__insert(map(K, V), K, V) = map(K, V) is semidet.
 
 	% Insert a new key and corresponding value into a map.
 	% Abort if the key already exists.
+	%
 :- pred map__det_insert(map(K, V)::in, K::in, V::in, map(K, V)::out) is det.
 :- func map__det_insert(map(K, V), K, V) = map(K, V).
 
 	% Apply map__det_insert to key - value pairs from corresponding lists.
+	%
 :- pred map__det_insert_from_corresponding_lists(map(K, V)::in, list(K)::in,
 	list(V)::in, map(K, V)::out) is det.
 
@@ -106,12 +114,14 @@
 	= map(K, V).
 
 	% Apply map__det_insert to key - value pairs from the assoc_lists.
+	%
 :- pred map__det_insert_from_assoc_list(map(K, V)::in, assoc_list(K, V)::in,
 	map(K, V)::out) is det.
 :- func map__det_insert_from_assoc_list(map(K, V), assoc_list(K, V))
 	= map(K, V).
 
 	% Apply map__set to key - value pairs from corresponding lists.
+	%
 :- pred map__set_from_corresponding_lists(map(K, V)::in, list(K)::in,
 	list(V)::in, map(K, V)::out) is det.
 :- func map__set_from_corresponding_lists(map(K, V), list(K), list(V))
Index: library/math.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.48
diff -u -r1.48 math.m
--- library/math.m	15 Mar 2004 23:49:33 -0000	1.48
+++ library/math.m	31 Jan 2005 04:18:15 -0000
@@ -40,42 +40,65 @@
 :- module math.
 :- interface.
 
+	% A domain error exception, indicates that the inputs to a function
+	% were outside the domain of the function.  The string indicates
+	% where the error occurred.
+	%
+	% It is possible to switch domain checking off, in which case,
+	% depending on the backend, a domain error may cause a program
+	% abort.
+	%
+:- type domain_error ---> domain_error(string).
+
 %---------------------------------------------------------------------------%
+%
 % Mathematical constants
+%
 
 	% Pythagoras' number
+	%
 :- func math__pi = float.
 
 	% Base of natural logarithms
+	%
 :- func math__e = float.
 
 %---------------------------------------------------------------------------%
+%
 % "Next integer" operations
+%
 
 	% math__ceiling(X) = Ceil is true if Ceil is the smallest integer
 	% not less than X.
+	%
 :- func math__ceiling(float) = float.
 
 	% math__floor(X) = Floor is true if Floor is the largest integer
 	% not greater than X.
+	%
 :- func math__floor(float) = float.
 
 	% math__round(X) = Round is true if Round is the integer
 	% closest to X.  If X has a fractional value of 0.5, it
 	% is rounded up.
+	%
 :- func math__round(float) = float.
 
 	% math__truncate(X) = Trunc is true if Trunc is the integer
 	% closest to X such that |Trunc| =< |X|.
+	%
 :- func math__truncate(float) = float.
 
 %---------------------------------------------------------------------------%
+%
 % Polynomial roots
+%
 
 	% math__sqrt(X) = Sqrt is true if Sqrt is the positive square
 	% root of X.
 	%
 	% Domain restriction: X >= 0
+	%
 :- func math__sqrt(float) = float.
 
 :- type math__quadratic_roots
@@ -87,101 +110,114 @@
 	% the solutions to the equation Ax^2 + Bx + C.
 	%
 	% Domain restriction: A \= 0
+	%
 :- func math__solve_quadratic(float, float, float) = quadratic_roots.
 
 %---------------------------------------------------------------------------%
+%
 % Power/logarithm operations
+%
 
 	% math__pow(X, Y) = Res is true if Res is X raised to the
 	% power of Y.
 	%
 	% Domain restriction: X >= 0 and (X = 0 implies Y > 0)
+	%
 :- func math__pow(float, float) = float.
 
 	% math__exp(X) = Exp is true if Exp is e raised to the
 	% power of X.
+	%
 :- func math__exp(float) = float.
 
 	% math__ln(X) = Log is true if Log is the natural logarithm
 	% of X.
 	%
 	% Domain restriction: X > 0
+	%
 :- func math__ln(float) = float.
 
 	% math__log10(X) = Log is true if Log is the logarithm to
 	% base 10 of X.
 	%
 	% Domain restriction: X > 0
+	%
 :- func math__log10(float) = float.
 
 	% math__log2(X) = Log is true if Log is the logarithm to
 	% base 2 of X.
 	%
 	% Domain restriction: X > 0
+	%
 :- func math__log2(float) = float.
 
 	% math__log(B, X) = Log is true if Log is the logarithm to
 	% base B of X.
 	%
 	% Domain restriction: X > 0 and B > 0 and B \= 1
+	%
 :- func math__log(float, float) = float.
 
 %---------------------------------------------------------------------------%
+%
 % Trigonometric operations
+%
 
 	% math__sin(X) = Sin is true if Sin is the sine of X.
+	%
 :- func math__sin(float) = float.
 
 	% math__cos(X) = Cos is true if Cos is the cosine of X.
+	%
 :- func math__cos(float) = float.
 
 	% math__tan(X) = Tan is true if Tan is the tangent of X.
+	%
 :- func math__tan(float) = float.
 
 	% math__asin(X) = ASin is true if ASin is the inverse
 	% sine of X, where ASin is in the range [-pi/2,pi/2].
 	%
 	% Domain restriction: X must be in the range [-1,1]
+	%
 :- func math__asin(float) = float.
 
 	% math__acos(X) = ACos is true if ACos is the inverse
 	% cosine of X, where ACos is in the range [0, pi].
 	%
 	% Domain restriction: X must be in the range [-1,1]
+	%
 :- func math__acos(float) = float.
 
 	% math__atan(X) = ATan is true if ATan is the inverse
 	% tangent of X, where ATan is in the range [-pi/2,pi/2].
+	%
 :- func math__atan(float) = float.
 
 	% math__atan2(Y, X) = ATan is true if ATan is the inverse
 	% tangent of Y/X, where ATan is in the range [-pi,pi].
+	%
 :- func math__atan2(float, float) = float.
 
 %---------------------------------------------------------------------------%
+%
 % Hyperbolic functions
+%
 
 	% math__sinh(X) = Sinh is true if Sinh is the hyperbolic
 	% sine of X.
+	%
 :- func math__sinh(float) = float.
 
 	% math__cosh(X) = Cosh is true if Cosh is the hyperbolic
 	% cosine of X.
+	%
 :- func math__cosh(float) = float.
 
 	% math__tanh(X) = Tanh is true if Tanh is the hyperbolic
 	% tangent of X.
-:- func math__tanh(float) = float.
-
-	% A domain error exception, indicates that the inputs to a function
-	% were outside the domain of the function.  The string indicates
-	% where the error occurred.
 	%
-	% It is possible to switch domain checking off, in which case,
-	% depending on the backend, a domain error may cause a program
-	% abort.
-	
-:- type domain_error ---> domain_error(string).
+:- func math__tanh(float) = float.
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: library/multi_map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/multi_map.m,v
retrieving revision 1.15
diff -u -r1.15 multi_map.m
--- library/multi_map.m	27 Jan 2005 03:45:24 -0000	1.15
+++ library/multi_map.m	31 Jan 2005 06:39:42 -0000
@@ -105,6 +105,10 @@
 :- pred multi_map__set(multi_map(K, V)::in, K::in, V::in, multi_map(K, V)::out)
 	is det.
 
+:- func multi_map__add(multi_map(K, V), K, V) = multi_map(K, V).
+:- pred multi_map__add(multi_map(K, V)::in, K::in, V::in, multi_map(K, V)::out)
+	is det.
+
 	% Given a multi_map, return a list of all the keys in the multi_map
 	%
 :- func multi_map__keys(multi_map(K, _V)) = list(K).
@@ -303,6 +307,9 @@
 		map__det_insert(MultiMap0, Key, [Value], MultiMap)
 	).
 
+multi_map__add(MultiMap0, Key, Value, MultiMap) :-
+	multi_map__set(MultiMap0, Key, Value, MultiMap).
+
 multi_map__keys(MultiMap, KeyList) :-
 	map__keys(MultiMap, KeyList).
 
@@ -486,6 +493,9 @@
 	multi_map__det_replace(MultiMap0, Key, Value, MultiMap).
 
 multi_map__set(MultiMap0, Key, Value) = MultiMap :-
+	multi_map__set(MultiMap0, Key, Value, MultiMap).
+
+multi_map__add(MultiMap0, Key, Value) = MultiMap :-
 	multi_map__set(MultiMap0, Key, Value, MultiMap).
 
 multi_map__keys(MultiMap) = Keys :-
Index: library/ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.47
diff -u -r1.47 ops.m
--- library/ops.m	27 Jan 2005 03:59:27 -0000	1.47
+++ library/ops.m	31 Jan 2005 04:22:27 -0000
@@ -29,6 +29,7 @@
 
 		% Check whether a string is the name of an infix operator,
 		% and if it is, return its precedence and associativity.
+		%
 	pred ops__lookup_infix_op(Table::in, string::in, ops__priority::out,
 		ops__assoc::out, ops__assoc::out) is semidet,
 
@@ -36,30 +37,36 @@
 		% where `Op' is a variable or a name and `X' and `Y'
 		% are terms. If operator terms are included in `Table',
 		% return their precedence and associativity.
+		%
 	pred ops__lookup_operator_term(Table::in, ops__priority::out,
 		ops__assoc::out, ops__assoc::out) is semidet,
 
 		% Check whether a string is the name of a prefix operator,
 		% and if it is, return its precedence and associativity.
+		%
 	pred ops__lookup_prefix_op(Table::in, string::in,
 		ops__priority::out, ops__assoc::out) is semidet,
 
 		% Check whether a string is the name of a binary prefix
 		% operator, and if it is, return its precedence and
 		% associativity.
+		%
 	pred ops__lookup_binary_prefix_op(Table::in, string::in,
 		ops__priority::out, ops__assoc::out, ops__assoc::out)
 		is semidet,
 		
 		% Check whether a string is the name of a postfix operator,
 		% and if it is, return its precedence and associativity.
+		%
 	pred ops__lookup_postfix_op(Table::in, string::in, ops__priority::out,
 		ops__assoc::out) is semidet,
 
 		% Check whether a string is the name of an operator
+		%
 	pred ops__lookup_op(Table::in, string::in) is semidet,
 
 		% Returns the highest priority number (the lowest is zero).
+		%
 	func ops__max_priority(Table) = ops__priority,
 
 		% The maximum priority of an operator appearing
@@ -69,6 +76,7 @@
 		% This will generally be the precedence of `,/2' less one.
 		% If `,/2' does not appear in the op_table,
 		% `ops__max_priority' plus one may be a reasonable value.
+		%
 	func ops__arg_priority(Table) = ops__priority
 ].
 
@@ -77,6 +85,7 @@
 	% The table of Mercury operators.
 	% See the "Builtin Operators" section of the "Syntax" chapter
 	% of the Mercury Language Reference Manual for details.
+	%
 :- type ops__mercury_op_table.
 :- instance ops__op_table(ops__mercury_op_table).
 
@@ -90,6 +99,7 @@
 	% would parse as `(2 * X) + Y'.
 	%
 	% The lowest priority is 0.
+	%
 :- type ops__priority == int.
 
 %-----------------------------------------------------------------------------%
@@ -103,6 +113,7 @@
 	% lower or equal to that of the operator.
 	% For example, `yfx' indicates a left-associative infix operator,
 	% while `xfy' indicates a right-associative infix operator.
+	%
 :- type ops__specifier
 	--->	fx ; fy ; xf ; yf ; xfx ; yfx ; xfy ; fxx ; fxy ; fyx.
 
@@ -117,6 +128,7 @@
 
 	% convert an ops__specifer (e.g. `xfy') to an ops__class
 	% (e.g. `infix(x, y)').
+	%
 :- pred ops__op_specifier_to_class(ops__specifier::in, ops__class::out) is det.
 
 %-----------------------------------------------------------------------------%
@@ -134,14 +146,6 @@
 
 :- type ops__table == ops__mercury_op_table.
 
-	% create an op_table with the standard Mercury operators.
-:- pred ops__init_op_table(ops__table).
-:- mode ops__init_op_table(uo) is det.
-:- pragma obsolete(ops__init_op_table/1).
-
-:- func ops__init_op_table = ops__table.
-:- pragma obsolete(ops__init_op_table/0).
-
 %-----------------------------------------------------------------------------%
 
 :- implementation.
@@ -341,8 +345,5 @@
 
 % (*) means that the operator is not useful in Mercury
 %     and is provided only for compatibility.
-
-ops__init_op_table(ops__mercury_op_table).
-ops__init_op_table = ops__mercury_op_table.
 
 %-----------------------------------------------------------------------------%
Index: library/parser.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/parser.m,v
retrieving revision 1.44
diff -u -r1.44 parser.m
--- library/parser.m	15 Mar 2004 06:50:16 -0000	1.44
+++ library/parser.m	31 Jan 2005 04:23:38 -0000
@@ -44,11 +44,13 @@
 
 	% parser__read_term(Result):
 	%	Reads a Mercury term from the current input stream.
+	%
 :- pred parser__read_term(read_term(T)::out, io::di, io::uo) is det.
 
 	% parser__read_term_with_op_table(Result):
 	%	Reads a term from the current input stream, using the
 	%	given op_table to interpret the operators.
+	%
 :- pred parser__read_term_with_op_table(Ops::in, read_term(T)::out,
 	io::di, io::uo) is det <= op_table(Ops).
 
@@ -58,16 +60,18 @@
 	%	this is used in constructing the term__contexts in the read
 	%	term. This interface is used to support the `:- pragma
 	%	source_file' directive.
+	%
 :- pred parser__read_term(string::in, read_term(T)::out, io::di, io::uo)
 	is det.
 
 	% parser__read_term_with_op_table(Ops, FileName, Result):
 	%	As above but using the given op_table.
+	%
 :- pred parser__read_term_with_op_table(Ops::in, string::in, read_term(T)::out,
 	io::di, io::uo) is det <= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
-	%
+
 	% parser__read_term_from_string/{4,6}:
 	%	Parses terms from a string.
 
@@ -81,35 +85,41 @@
 	% string at which to start parsing.
 
 	% parser__read_term_from_string(FileName, String, EndPos, Term).
+	%
 :- pred parser__read_term_from_string(string::in, string::in, posn::out,
 	read_term(T)::out) is det.
 
 	% parser__read_term_from_string_with_op_table(Ops, FileName,
 	%	String, EndPos, Term).
+	%
 :- pred parser__read_term_from_string_with_op_table(Ops::in, string::in,
 	string::in, posn::out, read_term(T)::out) is det <= op_table(Ops).
 
 	% parser__read_term_from_string(FileName, String, MaxOffset, StartPos,
 	%	EndPos, Term).
+	%
 :- pred parser__read_term_from_string(string::in, string::in, int::in,
 	posn::in, posn::out, read_term(T)::out) is det.
 
 	% parser__read_term_from_string_with_op_table(Ops, FileName, String,
 	%	MaxOffset, StartPos, EndPos, Term).
+	%
 :- pred parser__read_term_from_string_with_op_table(Ops::in, string::in,
 	string::in, int::in, posn::in, posn::out, read_term(T)::out) is det
 	<= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
-	%
+
 	% parser__parse_tokens/{3,4}:
 	%	Parses a list of tokens.
 
 	% parser__parse_tokens(FileName, TokenList, Result):
+	%
 :- pred parser__parse_tokens(string::in, token_list::in, read_term(T)::out)
 	is det.
 
 	% parser__parse_tokens(FileName, TokenList, Result):
+	%
 :- pred parser__parse_tokens_with_op_table(Ops::in, string::in,
 	token_list::in, read_term(T)::out) is det <= op_table(Ops).
 
Index: library/rbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rbtree.m,v
retrieving revision 1.19
diff -u -r1.19 rbtree.m
--- library/rbtree.m	24 Jan 2005 23:16:38 -0000	1.19
+++ library/rbtree.m	31 Jan 2005 05:11:27 -0000
@@ -176,10 +176,14 @@
 :- pred rbtree__assoc_list_to_rbtree(assoc_list(K, V)::in, rbtree(K, V)::out) 
 	is det.
 
+:- func rbtree__from_assoc_list(assoc_list(K, V)) = rbtree(K, V).
+
 :- func rbtree__rbtree_to_assoc_list(rbtree(K, V)) = assoc_list(K, V).
 :- pred rbtree__rbtree_to_assoc_list(rbtree(K, V)::in, assoc_list(K, V)::out)
 	is det.
 
+:- func rbtree__to_assoc_list(rbtree(K, V)) = assoc_list(K, V).
+
 :- func rbtree__foldl(func(K, V, T) = T, rbtree(K, V), T) = T.
 :- pred rbtree__foldl(pred(K, V, T, T), rbtree(K, V), T, T).
 :- mode rbtree__foldl(pred(in, in, in, out) is det, in, in, out) is det.
@@ -1141,6 +1145,10 @@
 	P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
 	rbtree__map_values(P, T1, T2).
 
-%------------------------------------------------------------------------------%
+rbtree__from_assoc_list(AList) = rbtree__assoc_list_to_rbtree(AList).
+
+rbtree__to_assoc_list(T) = rbtree__rbtree_to_assoc_list(T).
+
+%-----------------------------------------------------------------------------%
 :- end_module rbtree.
-%------------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
Index: library/set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set.m,v
retrieving revision 1.69
diff -u -r1.69 set.m
--- library/set.m	24 Jan 2005 23:16:38 -0000	1.69
+++ library/set.m	31 Jan 2005 05:12:44 -0000
@@ -20,15 +20,21 @@
 
 :- type set(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__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).
 
-	% A synonym for set.list_to_set/1.
+	% Synonyms for set.list_to_set/1.
 	%
 :- func set__from_list(list(T)) = set(T).
+:- func set__set(list(T)) = set(T).
 
 	% `set__sorted_list_to_set(List, Set)' is true iff `Set' is the set
 	% containing only the members of `List'.  `List' must be sorted
@@ -48,11 +54,6 @@
 :- 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'.
 	%
@@ -317,6 +318,8 @@
 	set_ordlist__list_to_set(List, Set).
 
 set__from_list(List) = set_ordlist__from_list(List).
+
+set__set(List) = set_ordlist__from_list(List).
 
 set__sorted_list_to_set(List, Set) :-
 	set_ordlist__sorted_list_to_set(List, Set).
Index: library/stack.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/stack.m,v
retrieving revision 1.19
diff -u -r1.19 stack.m
--- library/stack.m	24 Jan 2005 23:16:39 -0000	1.19
+++ library/stack.m	31 Jan 2005 06:40:17 -0000
@@ -17,22 +17,22 @@
 :- interface.
 :- import_module list.
 
-:- type stack(_T).
+:- type stack(T).
 
 	% `stack__init(Stack)' is true iff `Stack' is an empty stack.
 	%
-:- pred stack__init(stack(_T)::out) is det.
+:- pred stack__init(stack(T)::out) is det.
 :- func stack__init = stack(T).
 
 	% `stack__is_empty(Stack)' is true iff `Stack' is an empty stack.
 	%
-:- pred stack__is_empty(stack(_T)::in) is semidet.
+:- pred stack__is_empty(stack(T)::in) is semidet.
 
 	% `stack__is_full(Stack)' is intended to be true iff `Stack'
 	% is a stack whose capacity is exhausted.  This implementation
 	% allows arbitrary-sized stacks, so stack__is_full always fails.
 	%
-:- pred stack__is_full(stack(_T)::in) is semidet.
+:- pred stack__is_full(stack(T)::in) is semidet.
 
 	% `stack__push(Stack0, Elem, Stack)' is true iff `Stack' is
 	% the stack which results from pushing `Elem' onto the top
@@ -58,6 +58,7 @@
 	%
 :- pred stack__top_det(stack(T)::in, T::out) is det.
 :- func stack__top_det(stack(T)) = T.
+:- func stack__det_top(stack(T)) = T.
 
 	% `stack__pop(Stack0, Elem, Stack)' is true iff `Stack0' is
 	% a non-empty stack whose top element is `Elem', and `Stack'
@@ -69,11 +70,12 @@
 	% call error/1 rather than failing if given an empty stack.
 	%
 :- pred stack__pop_det(stack(T)::in, T::out, stack(T)::out) is det.
+:- pred stack__det_pop(stack(T)::in, T::out, stack(T)::out) is det.
 
 	% `stack__depth(Stack, Depth)' is true iff `Stack' is a stack
 	% containing `Depth' elements.
 	%
-:- pred stack__depth(stack(_T)::in, int::out) is det.
+:- pred stack__depth(stack(T)::in, int::out) is det.
 :- func stack__depth(stack(T)) = int.
 
 %--------------------------------------------------------------------------%
@@ -118,6 +120,9 @@
 		error("stack__pop_det: pop from empty stack")
 	).
 
+stack__det_pop(Stack0, Elem, Stack) :-
+	stack__pop_det(Stack0, Elem, Stack).
+
 stack__depth(Stack, Depth) :-
 	list__length(Stack, Depth).
 
@@ -136,6 +141,9 @@
 	stack__push_list(S1, Xs, S2).
 
 stack__top_det(S) = X :-
+	stack__top_det(S, X).
+
+stack__det_top(S) = X :-
 	stack__top_det(S, X).
 
 stack__depth(S) = N :-
Index: library/store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.46
diff -u -r1.46 store.m
--- library/store.m	24 Jan 2005 23:16:39 -0000	1.46
+++ library/store.m	31 Jan 2005 05:20:29 -0000
@@ -52,6 +52,7 @@
 
 	% generic_mutvar(T, S):
 	% a mutable variable holding a value of type T in store S
+	%
 :- type generic_mutvar(T, S).
 :- type io_mutvar(T) == generic_mutvar(T, io__state).
 :- type store_mutvar(T, S) == generic_mutvar(T, store(S)).
@@ -223,21 +224,6 @@
 % Some of these are unsafe.  All of them are deprecated.
 %
 
-	% OBSOLETE: use `S' or `some [S] ... S' instead.
-:- type some_store_type.
-
-	% initialize a store
-	% OBSOLETE: use store__new/1 instead
-:- pred store__init(store(some_store_type)).
-:- mode store__init(uo) is det.
-:- pragma obsolete(store__init/1).
-
-	% OBSOLETE: use store_mutvar/2 or generic_mutvar/2 instead.
-:- type mutvar(T, S) == store_mutvar(T, S).
-
-	% OBSOLETE: use store_mutvar/2 or generic_mutvar/2 instead.
-:- type ref(T, S) == store_ref(T, S).
-
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
@@ -248,8 +234,6 @@
 :- instance store(store(S)) where [].
 :- instance store(io__state) where [].
 
-:- type some_store_type ---> some_store_type.
-
 % The store type itself is just a dummy type,
 % with no real representation.
 
@@ -280,10 +264,7 @@
 store__new(S) :-
 	store__do_init(S).
 
-store__init(S) :-
-	store__do_init(S).
-
-:- pred store__do_init(store(some_store_type)::uo) is det.
+:- some [S] pred store__do_init(store(S)::uo) is det.
 
 :- pragma foreign_proc("C", store__do_init(_S0::uo),
 	[will_not_call_mercury, promise_pure], "").
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.225
diff -u -r1.225 string.m
--- library/string.m	24 Jan 2005 23:16:39 -0000	1.225
+++ library/string.m	31 Jan 2005 06:26:41 -0000
@@ -127,7 +127,7 @@
 :- pred string__int_to_base_string(int, int, string).
 :- mode string__int_to_base_string(in, in, uo) is det.
 
-	% Convert an float to a string.
+	% Convert a float to a string.
 	% In the current implementation the resulting float will be in the
 	% form that it was printed using the format string "%#.<prec>g".
 	% <prec> will be in the range p to (p+2)
@@ -3353,7 +3353,7 @@
 	copy(Str0, Str),
 	string__length_2(Str, 0, Len).
 
-:- pred string__length_2(string::in, int::di, int::uo) is det.
+:- pred string__length_2(string::in, int::in, int::out) is det.
 
 string__length_2(Str, Index, Length) :-
 	( string__index(Str, Index, _) ->
Index: library/time.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/time.m,v
retrieving revision 1.45
diff -u -r1.45 time.m
--- library/time.m	7 Jul 2004 07:11:07 -0000	1.45
+++ library/time.m	31 Jan 2005 05:26:20 -0000
@@ -25,10 +25,12 @@
 	% NOTE: the unit used for a value of this type depends on whether it was
 	% returned by `time__clock' or `time__times'.  See the comments on these
 	% predicates below.
+	%
 :- type clock_t == int.
 
 	% The `tms' type holds information about the amount of processor
 	% time that a process and its child processes have consumed.
+	%
 :- type tms --->
 	tms(
 		clock_t,	% tms_utime: user time
@@ -39,6 +41,7 @@
 
 	% The `time_t' type is an abstract type that represents
 	% calendar times.
+	%
 :- type time_t.
 
 	% The `tm' type is a concrete type that represents calendar
@@ -46,6 +49,7 @@
 	% Comparison (via compare/3) of `tm' values whose `tm_dst'
 	% components are identical is equivalent to comparison of
 	% the times those `tm' values represent.
+	%
 :- type tm --->
 	tm(
 		tm_year	:: int,		% Year (number since 1900)
@@ -66,6 +70,7 @@
 
 	% Some of the procedures in this module throw this type
 	% as an exception if they can't obtain a result.
+	%
 :- type time_error --->
 	time_error(string).	% Error message
 
--------------------------------------------------------------------------
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