[m-dev.] diff: make functions appear in reference manual
Simon Taylor
stayl at cs.mu.OZ.AU
Mon Nov 13 10:10:54 AEDT 2000
> On 12-Nov-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > Estimated hours taken: 2.5
> >
> > library/*.m
> > Make the function versions of predicates appear in the
> > Mercury Library Reference Manual.
Missed a couple.
Simon.
Estimated hours taken: 2.5
library/bintree_set.m:
library/int.m:
library/std_util.m:
Make the function versions of predicates appear in the
Mercury Library Reference Manual (I missed a couple last time).
Index: bintree_set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bintree_set.m,v
retrieving revision 1.18
diff -u -u -r1.18 bintree_set.m
--- bintree_set.m 2000/11/12 05:51:00 1.18
+++ bintree_set.m 2000/11/12 22:50:10
@@ -32,6 +32,8 @@
:- pred bintree_set__list_to_set(list(T), bintree_set(T)).
:- mode bintree_set__list_to_set(in, out) is det.
+:- func bintree_set__list_to_set(list(T)) = bintree_set(T).
+
% `bintree_set__sorted_list_to_set(List, Set)' is true iff
% `Set' is the set containing only the members of `List'.
% `List' must be sorted.
@@ -39,6 +41,8 @@
:- pred bintree_set__sorted_list_to_set(list(T), bintree_set(T)).
:- mode bintree_set__sorted_list_to_set(in, out) is det.
+:- func bintree_set__sorted_list_to_set(list(T)) = bintree_set(T).
+
% `bintree_set__list_to_bintree_set(Set, List)' is true iff
% `List' is the list of all the members of `Set', in sorted
% order.
@@ -46,6 +50,8 @@
:- pred bintree_set__to_sorted_list(bintree_set(T), list(T)).
:- mode bintree_set__to_sorted_list(in, out) is det.
+:- func bintree_set__to_sorted_list(bintree_set(T)) = list(T).
+
% `bintree_set__init(Set)' is true iff `Set' is an empty set.
:- pred bintree_set__init(bintree_set(_T)).
@@ -97,6 +103,8 @@
:- mode bintree_set__insert(di, di, uo) is det.
:- mode bintree_set__insert(in, in, out) is det.
+:- func bintree_set__insert(bintree_set(T), T) = bintree_set(T).
+
% `bintree_set__insert_list(Set0, Xs, Set)' is true iff `Set'
% is the union of `Set0' and the set containing only the
% members of `Xs'.
@@ -105,6 +113,8 @@
:- mode bintree_set__insert_list(di, di, uo) is det.
:- mode bintree_set__insert_list(in, in, out) is det.
+:- func bintree_set__insert_list(bintree_set(T), list(T)) = bintree_set(T).
+
% `bintree_set__remove(Set0, X, Set)' is true iff `Set0' contains `X',
% and `Set' is the relative complement of `Set0' and the set
% containing only `X', i.e. if `Set' is the set which contains
@@ -131,6 +141,8 @@
:- pred bintree_set__delete(bintree_set(T), T, bintree_set(T)).
:- mode bintree_set__delete(in, in, out) is det.
+:- func bintree_set__delete(bintree_set(T), T) = bintree_set(T).
+
% `bintree_set__delete_list(Set0, Xs, Set)' is true iff `Set'
% is the relative complement of `Set0' and the set containing
% only the members of `Xs'.
@@ -138,6 +150,8 @@
:- pred bintree_set__delete_list(bintree_set(T), list(T), bintree_set(T)).
:- mode bintree_set__delete_list(in, in, out) is det.
+:- func bintree_set__delete_list(bintree_set(T), list(T)) = bintree_set(T).
+
% `set_union(SetA, SetB, Set)' is true iff `Set' is the union of
% `SetA' and `SetB'. If the sets are known to be of different
% sizes, then for efficiency make `SetA' the larger of the two.
@@ -145,6 +159,8 @@
:- pred bintree_set__union(bintree_set(T), bintree_set(T), bintree_set(T)).
:- mode bintree_set__union(in, in, out) is det.
+:- func bintree_set__union(bintree_set(T), bintree_set(T)) = bintree_set(T).
+
% `set_intersect(SetA, SetB, Set)' is true iff `Set' is the
% intersection of `SetA' and `SetB'.
@@ -152,6 +168,8 @@
bintree_set(T)).
:- mode bintree_set__intersect(in, in, out) is det.
+:- func bintree_set__intersect(bintree_set(T), bintree_set(T)) = bintree_set(T).
+
%--------------------------------------------------------------------------%
:- implementation.
@@ -268,31 +286,6 @@
%--------------------------------------------------------------------------%
% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
% Function forms added.
-
-:- interface.
-
-:- func bintree_set__list_to_set(list(T)) = bintree_set(T).
-
-:- func bintree_set__sorted_list_to_set(list(T)) = bintree_set(T).
-
-:- func bintree_set__to_sorted_list(bintree_set(T)) = list(T).
-
-:- func bintree_set__insert(bintree_set(T), T) = bintree_set(T).
-
-:- func bintree_set__insert_list(bintree_set(T), list(T)) = bintree_set(T).
-
-:- func bintree_set__delete(bintree_set(T), T) = bintree_set(T).
-
-:- func bintree_set__delete_list(bintree_set(T), list(T)) = bintree_set(T).
-
-:- func bintree_set__union(bintree_set(T), bintree_set(T)) = bintree_set(T).
-
-:- func bintree_set__intersect(bintree_set(T), bintree_set(T)) = bintree_set(T).
-
-% ---------------------------------------------------------------------------- %
-% ---------------------------------------------------------------------------- %
-
-:- implementation.
bintree_set__list_to_set(Xs) = BT :-
bintree_set__list_to_set(Xs, BT).
Index: int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.70
diff -u -u -r1.70 int.m
--- int.m 2000/11/12 05:51:01 1.70
+++ int.m 2000/11/12 22:42:22
@@ -76,6 +76,8 @@
:- 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.
@@ -86,12 +88,17 @@
:- mode uo * in = in is semidet.
:- mode in * uo = in is semidet.
*/
+
+:- 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.
+
% flooring integer division
% truncates towards minus infinity, e.g. (-10) // 3 = (-4).
:- func div(int, int) = int.
@@ -180,14 +187,20 @@
% on this machine.
:- pred int__max_int(int::out) is det.
+:- func int__max_int = int.
+
% int__min_int(Max) binds Min to the minimum value of an int
% on this machine.
:- pred int__min_int(int::out) is det.
+:- func int__min_int = int.
+
% int__bits_per_int(Bits) binds Bits to the number of bits in an int
% on this machine.
:- pred int__bits_per_int(int::out) is det.
+:- func int__bits_per_int = int.
+
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -494,25 +507,6 @@
%-----------------------------------------------------------------------------%
% Ralph Becket <rwab1 at cl.cam.ac.uk> 27/04/99
% Functional forms added.
-
-:- interface.
-
-:- func int__plus(int, int) = int.
-
-:- func int__times(int, int) = int.
-
-:- func int__minus(int, int) = int.
-
-:- func int__max_int = int.
-
-:- func int__min_int = int.
-
-:- func int__bits_per_int = int.
-
-% ---------------------------------------------------------------------------- %
-% ---------------------------------------------------------------------------- %
-
-:- implementation.
int__plus(X, Y) = X + Y.
Index: std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.204
diff -u -u -r1.204 std_util.m
--- std_util.m 2000/11/12 08:51:37 1.204
+++ std_util.m 2000/11/12 22:48:30
@@ -11,9 +11,6 @@
% This file is intended for all the useful standard utilities
% that don't belong elsewhere, like <stdlib.h> in C.
-% Ralph Becket <rwab1 at cam.sri.com> 24/04/99
-% Function forms added.
-
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list