[m-dev.] for review: more function def's for single out det mode library predicates

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Oct 30 13:47:58 AEST 1999


On 30-Apr-1999, Ralph Becket <rwab1 at cam.sri.com> wrote:
> Estimated hours taken: 5
> 
> 	I've added functions for the remaining output det predicates in a number
> 	of modules in the standard library. [...]

I've finally gotten around to applying those changes.
Ralph, please use context or unified diffs (`diff -u' or `diff -c')
next time.

----------

Estimated hours taken: 6

Commit Ralph Becket <rwab1 at cam.sri.com>'s changes to add functions for
the remaining one-output det predicates in a number of modules in the
standard library.

library/pqueue.m:
library/assoc_list.m:
library/getopt.m:
library/bag.m:
library/bimap.m:
library/bintree.m:
library/bintree_set.m:
library/bt_array.m:
library/eqvclass.m:
library/graph.m:
library/group.m:
library/queue.m:
library/rbtree.m:
library/stack.m:
library/term.m:
library/varset.m:
library/tree234.m:
library/relation.m:
library/set.m:
library/set_bbbtree.m:
library/set_ordlist.m:
library/set_unordlist.m:
	For each det predicate with one output

		:- pred f(in, ..., in, out) is det.

	I've added the declaration

		:- func f(in, ..., in) = out.

	and definition

		f(X1, ..., Xn) = Y :-
			f(X1, ..., Xn, Y).

	(The changes were made using a mostly automatic process.)

cvs diff: Diffing .
Index: assoc_list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/assoc_list.m,v
retrieving revision 1.9
diff -u -d -u -r1.9 assoc_list.m
--- assoc_list.m	1998/01/23 12:33:06	1.9
+++ assoc_list.m	1999/10/30 03:46:15
@@ -128,3 +128,35 @@
 	).
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Functional forms added.
+
+:- interface.
+
+:- func assoc_list__reverse_members(assoc_list(K, V)) = assoc_list(V, K).
+
+:- func assoc_list__from_corresponding_lists(list(K), list(V)) = assoc_list(K,V).
+
+:- func assoc_list__keys(assoc_list(K, V)) = list(K).
+
+:- func assoc_list__values(assoc_list(K, V)) = list(V).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+assoc_list__reverse_members(AL1) = AL2 :-
+	assoc_list__reverse_members(AL1, AL2).
+
+assoc_list__from_corresponding_lists(Ks, Vs) = AL :-
+	assoc_list__from_corresponding_lists(Ks, Vs, AL).
+
+assoc_list__keys(AL) = Ks :-
+	assoc_list__keys(AL, Ks).
+
+assoc_list__values(AL) = Vs :-
+	assoc_list__values(AL, Vs).
+
+
Index: bag.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bag.m,v
retrieving revision 1.19
diff -u -d -u -r1.19 bag.m
--- bag.m	1999/08/27 04:40:58	1.19
+++ bag.m	1999/10/30 03:46:15
@@ -445,3 +445,96 @@
 			Res = (<)
 		)
 	).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func bag__init = bag(T).
+
+:- func bag__insert(bag(T), T) = bag(T).
+
+:- func bag__insert_list(bag(T), list(T)) = bag(T).
+
+:- func bag__from_list(list(T)) = bag(T).
+
+:- func bag__to_list(bag(T)) = list(T).
+
+:- func bag__to_assoc_list(bag(T)) = assoc_list(T, int).
+
+:- func bag__to_list_without_duplicates(bag(T)) = list(T).
+
+:- func bag__det_remove(bag(T), T) = bag(T).
+
+:- func bag__det_remove_list(bag(T), list(T)) = bag(T).
+
+:- func bag__delete(bag(T), T) = bag(T).
+
+:- func bag__delete_all(bag(T), T) = bag(T).
+
+:- func bag__count_value(bag(T), T) = int.
+
+:- func bag__subtract(bag(T), bag(T)) = bag(T).
+
+:- func bag__union(bag(T), bag(T)) = bag(T).
+
+:- func bag__intersect(bag(T), bag(T)) = bag(T).
+
+:- func bag__least_upper_bound(bag(T), bag(T)) = bag(T).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+bag__init = B :-
+	bag__init(B).
+
+bag__insert(B1, X) = B2 :-
+	bag__insert(B1, X, B2).
+
+bag__insert_list(B1, Xs) = B2 :-
+	bag__insert_list(B1, Xs, B2).
+
+bag__from_list(Xs) = B :-
+	bag__from_list(Xs, B).
+
+bag__to_list(B) = Xs :-
+	bag__to_list(B, Xs).
+
+bag__to_assoc_list(B) = AL :-
+	bag__to_assoc_list(B, AL).
+
+bag__to_list_without_duplicates(B) = Xs :-
+	bag__to_list_without_duplicates(B, Xs).
+
+bag__det_remove(B1, X) = B2 :-
+	bag__det_remove(B1, X, B2).
+
+bag__det_remove_list(B1, Xs) = B2 :-
+	bag__det_remove_list(B1, Xs, B2).
+
+bag__delete(B1, X) = B2 :-
+	bag__delete(B1, X, B2).
+
+bag__delete_all(B1, X) = B2 :-
+	bag__delete_all(B1, X, B2).
+
+bag__count_value(B, X) = N :-
+	bag__count_value(B, X, N).
+
+bag__subtract(B1, B2) = B3 :-
+	bag__subtract(B1, B2, B3).
+
+bag__union(B1, B2) = B3 :-
+	bag__union(B1, B2, B3).
+
+bag__intersect(B1, B2) = B3 :-
+	bag__intersect(B1, B2, B3).
+
+bag__least_upper_bound(B1, B2) = B3 :-
+	bag__least_upper_bound(B1, B2, B3).
+
Index: bimap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bimap.m,v
retrieving revision 1.12
diff -u -d -u -r1.12 bimap.m
--- bimap.m	1998/01/23 12:33:09	1.12
+++ bimap.m	1999/10/30 03:46:15
@@ -133,3 +133,54 @@
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Functional forms added.
+
+:- interface.
+
+:- func bimap__init = bimap(_,_).
+
+:- func bimap__lookup(bimap(K,V), K) = V.
+
+:- func bimap__set(bimap(K,V), K, V) = bimap(K,V).
+
+:- func bimap__ordinates(bimap(K, _V)) = list(K).
+
+:- func bimap__coordinates(bimap(_K, V)) = list(V).
+
+:- func bimap__to_assoc_list(bimap(K,V)) = assoc_list(K,V).
+
+:- func bimap__from_assoc_list(assoc_list(K,V)) = bimap(K,V).
+
+%%% :- func bimap__from_corresponding_lists(list(K), list(V)) = bimap(K, V).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+bimap__init = BM :-
+	bimap__init(BM).
+
+bimap__lookup(BM, K) = V :-
+	bimap__lookup(BM, K, V).
+
+bimap__set(BM1, K, V) = BM2 :-
+	bimap__set(BM1, K, V, BM2).
+
+bimap__ordinates(BM) = Ks :-
+	bimap__ordinates(BM, Ks).
+
+bimap__coordinates(BM) = Vs :-
+	bimap__coordinates(BM, Vs).
+
+bimap__to_assoc_list(BM) = AL :-
+	bimap__to_assoc_list(BM, AL).
+
+bimap__from_assoc_list(AL) = BM :-
+	bimap__from_assoc_list(AL, BM).
+
+%%% bimap__from_corresponding_lists(Ks, Vs) = BM :-
+%%% 	bimap__from_corresponding_lists(Ks, Vs, BM).
+
+
Index: bintree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bintree.m,v
retrieving revision 1.40
diff -u -d -u -r1.40 bintree.m
--- bintree.m	1999/03/15 08:48:05	1.40
+++ bintree.m	1999/10/30 03:46:15
@@ -546,3 +546,74 @@
 	).
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func bintree__set(bintree(K,V), K, V) = bintree(K,V).
+
+:- func bintree__lookup(bintree(K,V), K) = V.
+
+:- func bintree__delete(bintree(K,V), K) = bintree(K,V).
+
+:- func bintree__keys(bintree(K,_V)) = list(K).
+
+:- func bintree__values(bintree(_K,V)) = list(V).
+
+:- func bintree__from_list(assoc_list(K,V)) = bintree(K,V).
+
+:- func bintree__from_sorted_list(assoc_list(K,V)) = bintree(K,V).
+
+:- func bintree__from_corresponding_lists(list(K), list(V)) = bintree(K,V).
+
+:- func bintree__to_list(bintree(K,V)) = assoc_list(K,V).
+
+:- func bintree__count(bintree(_K,_V)) = int.
+
+:- func bintree__depth(bintree(_K,_V)) = int.
+
+:- func bintree__balance(bintree(K, V)) = bintree(K, V).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+bintree__set(BT1, K, V) = BT2 :-
+	bintree__set(BT1, K, V, BT2).
+
+bintree__lookup(BT, K) = V :-
+	bintree__lookup(BT, K, V).
+
+bintree__delete(BT1, K) = BT2 :-
+	bintree__delete(BT1, K, BT2).
+
+bintree__keys(BT) = Ks :-
+	bintree__keys(BT, Ks).
+
+bintree__values(BT) = Vs :-
+	bintree__values(BT, Vs).
+
+bintree__from_list(AL) = BT :-
+	bintree__from_list(AL, BT).
+
+bintree__from_sorted_list(AL) = BT :-
+	bintree__from_sorted_list(AL, BT).
+
+bintree__from_corresponding_lists(Ks, Vs) = BT :-
+	bintree__from_corresponding_lists(Ks, Vs, BT).
+
+bintree__to_list(BT) = AL :-
+	bintree__to_list(BT, AL).
+
+bintree__count(BT) = N :-
+	bintree__count(BT, N).
+
+bintree__depth(BT) = N :-
+	bintree__depth(BT, N).
+
+bintree__balance(BT1) = BT2 :-
+	bintree__balance(BT1, BT2).
+
Index: bintree_set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bintree_set.m,v
retrieving revision 1.16
diff -u -d -u -r1.16 bintree_set.m
--- bintree_set.m	1999/03/15 08:48:05	1.16
+++ bintree_set.m	1999/10/30 03:46:15
@@ -255,3 +255,60 @@
 	bintree_set__delete_list(S0, L1, S).
 
 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% 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).
+
+bintree_set__sorted_list_to_set(Xs) = BT :-
+	bintree_set__sorted_list_to_set(Xs, BT).
+
+bintree_set__to_sorted_list(BT) = Xs :-
+	bintree_set__to_sorted_list(BT, Xs).
+
+bintree_set__insert(BT1, X) = BT2 :-
+	bintree_set__insert(BT1, X, BT2).
+
+bintree_set__insert_list(BT1, Xs) = BT2 :-
+	bintree_set__insert_list(BT1, Xs, BT2).
+
+bintree_set__delete(BT1, X) = BT2 :-
+	bintree_set__delete(BT1, X, BT2).
+
+bintree_set__delete_list(BT1, Xs) = BT2 :-
+	bintree_set__delete_list(BT1, Xs, BT2).
+
+bintree_set__union(BT1, BT2) = BT3 :-
+	bintree_set__union(BT1, BT2, BT3).
+
+bintree_set__intersect(BT1, BT2) = BT3 :-
+	bintree_set__intersect(BT1, BT2, BT3).
+
+
Index: bt_array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bt_array.m,v
retrieving revision 1.6
diff -u -d -u -r1.6 bt_array.m
--- bt_array.m	1998/01/23 12:33:13	1.6
+++ bt_array.m	1999/10/30 03:46:15
@@ -627,3 +627,73 @@
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func bt_array__make_empty_array(int) = bt_array(T).
+
+:- func bt_array__init(int, int, T) = bt_array(T).
+
+:- func bt_array__min(bt_array(_T)) = int.
+
+:- func bt_array__max(bt_array(_T)) = int.
+
+:- func bt_array__size(bt_array(_T)) = int.
+
+:- func bt_array__lookup(bt_array(T), int) = T.
+
+:- func bt_array__set(bt_array(T), int, T) = bt_array(T).
+
+:- func bt_array__resize(bt_array(T), int, int, T) = bt_array(T).
+
+:- func bt_array__shrink(bt_array(T), int, int) = bt_array(T).
+
+:- func bt_array__from_list(int, list(T)) = bt_array(T).
+
+:- func bt_array__to_list(bt_array(T)) = list(T).
+
+:- func bt_array__fetch_items(bt_array(T), int, int) = list(T).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+bt_array__make_empty_array(N) = BTA :-
+	bt_array__make_empty_array(N, BTA).
+
+bt_array__init(N1, N2, T) = BTA :-
+	bt_array__init(N1, N2, T, BTA).
+
+bt_array__min(BTA) = N :-
+	bt_array__min(BTA, N).
+
+bt_array__max(BTA) = N :-
+	bt_array__max(BTA, N).
+
+bt_array__size(BTA) = N :-
+	bt_array__size(BTA, N).
+
+bt_array__lookup(BTA, N) = T :-
+	bt_array__lookup(BTA, N, T).
+
+bt_array__set(BT1A, N, T) = BTA2 :-
+	bt_array__set(BT1A, N, T, BTA2).
+
+bt_array__resize(BT1A, N1, N2, T) = BTA2 :-
+	bt_array__resize(BT1A, N1, N2, T, BTA2).
+
+bt_array__shrink(BT1A, N1, N2) = BTA2 :-
+	bt_array__shrink(BT1A, N1, N2, BTA2).
+
+bt_array__from_list(N, Xs) = BTA :-
+	bt_array__from_list(N, Xs, BTA).
+
+bt_array__to_list(BTA) = Xs :-
+	bt_array__to_list(BTA, Xs).
+
+bt_array__fetch_items(BTA, N1, N2) = Xs :-
+	bt_array__fetch_items(BTA, N1, N2, Xs).
+
Index: eqvclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/eqvclass.m,v
retrieving revision 1.9
diff -u -d -u -r1.9 eqvclass.m
--- eqvclass.m	1998/07/09 07:18:15	1.9
+++ eqvclass.m	1999/10/30 03:46:15
@@ -298,3 +298,57 @@
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func eqvclass__init = eqvclass(T).
+
+:- func eqvclass__ensure_element(eqvclass(T), T) = eqvclass(T).
+
+:- func eqvclass__new_element(eqvclass(T), T) = eqvclass(T).
+
+:- func eqvclass__ensure_equivalence(eqvclass(T), T, T) = eqvclass(T).
+
+:- func eqvclass__new_equivalence(eqvclass(T), T, T) = eqvclass(T).
+
+:- func eqvclass__partition_set(eqvclass(T)) = set(set(T)).
+
+:- func eqvclass__partition_list(eqvclass(T)) = list(set(T)).
+
+:- func eqvclass__partition_set_to_eqvclass(set(set(T))) = eqvclass(T).
+
+:- func eqvclass__partition_list_to_eqvclass(list(set(T))) = eqvclass(T).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+eqvclass__init = EC :-
+	eqvclass__init(EC).
+
+eqvclass__ensure_element(EC1, X) = EC2 :-
+	eqvclass__ensure_element(EC1, X, EC2).
+
+eqvclass__new_element(EC1, X) = EC2 :-
+	eqvclass__new_element(EC1, X, EC2).
+
+eqvclass__ensure_equivalence(EC1, X, Y) = EC2 :-
+	eqvclass__ensure_equivalence(EC1, X, Y, EC2).
+
+eqvclass__new_equivalence(EC1, X, Y) = EC2 :-
+	eqvclass__new_equivalence(EC1, X, Y, EC2).
+
+eqvclass__partition_set(EC) = S :-
+	eqvclass__partition_set(EC, S).
+
+eqvclass__partition_list(EC) = Xs :-
+	eqvclass__partition_list(EC, Xs).
+
+eqvclass__partition_set_to_eqvclass(S) = EC :-
+	eqvclass__partition_set_to_eqvclass(S, EC).
+
+eqvclass__partition_list_to_eqvclass(Xs) = EC :-
+	eqvclass__partition_list_to_eqvclass(Xs, EC).
Index: getopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/getopt.m,v
retrieving revision 1.21
diff -u -d -u -r1.21 getopt.m
--- getopt.m	1998/09/18 07:00:24	1.21
+++ getopt.m	1999/10/30 03:46:16
@@ -676,3 +676,47 @@
 	).
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Functional forms added.
+
+:- interface.
+
+:- func getopt__lookup_bool_option(option_table(Option), Option) = bool.
+
+:- func getopt__lookup_int_option(option_table(Option), Option) = int.
+
+:- func getopt__lookup_string_option(option_table(Option), Option) = string.
+
+:- func getopt__lookup_maybe_int_option(option_table(Option), Option) =
+		maybe(int).
+
+:- func getopt__lookup_maybe_string_option(option_table(Option), Option) =
+		maybe(string).
+
+:- func getopt__lookup_accumulating_option(option_table(Option), Option) =
+		list(string).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+getopt__lookup_bool_option(OT, Opt) = B :-
+	getopt__lookup_bool_option(OT, Opt, B).
+
+getopt__lookup_int_option(OT, Opt) = N :-
+	getopt__lookup_int_option(OT, Opt, N).
+
+getopt__lookup_string_option(OT, Opt) = S :-
+	getopt__lookup_string_option(OT, Opt, S).
+
+getopt__lookup_maybe_int_option(OT, Opt) = MN :-
+	getopt__lookup_maybe_int_option(OT, Opt, MN).
+
+getopt__lookup_maybe_string_option(OT, Opt) =MS :-
+	getopt__lookup_maybe_string_option(OT, Opt, MS).
+
+getopt__lookup_accumulating_option(OT, Opt) =Ss :-
+	getopt__lookup_accumulating_option(OT, Opt, Ss).
+
Index: graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.19
diff -u -d -u -r1.19 graph.m
--- graph.m	1998/03/03 17:25:57	1.19
+++ graph.m	1999/10/30 03:46:16
@@ -418,3 +418,38 @@
 
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+%	Function forms added.
+
+:- interface.
+
+:- func graph__init = graph(N, A).
+
+:- func graph__find_matching_nodes(graph(N, A), N) = set(node(N)).
+
+:- func graph__node_contents(graph(N, A), node(N)) = N.
+
+:- func graph__successors(graph(N, A), node(N)) = set(node(N)).
+
+:- func graph__nodes(graph(N, A)) = set(node(N)).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+graph__init = G :-
+	graph__init(G).
+
+graph__find_matching_nodes(G, N) = S :-
+	graph__find_matching_nodes(G, N, S).
+
+graph__node_contents(G, N) = NI :-
+	graph__node_contents(G, N, NI).
+
+graph__successors(G, N) = S :-
+	graph__successors(G, N, S).
+
+graph__nodes(G) = S :-
+	graph__nodes(G,S).
+
Index: group.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/group.m,v
retrieving revision 1.17
diff -u -d -u -r1.17 group.m
--- group.m	1998/01/23 12:33:19	1.17
+++ group.m	1999/10/30 03:46:16
@@ -247,3 +247,59 @@
 	G = group(C, S, E).
 
 %---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func group__init = group(T).
+
+:- func group__insert(group(T), set(T)) = group(T).
+
+:- func group__group(group(T), T) = set(T).
+
+:- func group__to_set(group(T)) = set(set(T)).
+
+:- func group__sets_and_keys(group(T)) = assoc_list(set(T), group__key).
+
+:- func group__group_key(group(T), T) = group__key.
+
+:- func group__key_group(group(T), group__key) = set(T).
+
+:- func group__largest_group_key(group(T)) = group__key.
+
+:- func group__group_keys(group(T)) = list(group__key).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+group__init = G :-
+	group__init(G).
+
+group__insert(G1, S) = G2 :-
+	group__insert(G1, S, G2).
+
+group__group(G, T) = S :-
+	group__group(G, T, S).
+
+group__to_set(G) = SS :-
+	group__to_set(G, SS).
+
+group__sets_and_keys(G) = AL :-
+	group__sets_and_keys(G, AL).
+
+group__group_key(G, T) = K :-
+	group__group_key(G, T, K).
+
+group__key_group(G, K) = S :-
+	group__key_group(G, K, S).
+
+group__largest_group_key(G) = K :-
+	group__largest_group_key(G, K).
+
+group__group_keys(G) = Ks :-
+	group__group_keys(G, Ks).
+
Index: pqueue.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/pqueue.m,v
retrieving revision 1.11
diff -u -d -u -r1.11 pqueue.m
--- pqueue.m	1998/01/23 12:33:27	1.11
+++ pqueue.m	1999/10/30 03:46:17
@@ -152,3 +152,35 @@
 	pqueue__insert(Q0, K, V, Q).
 
 %---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Functional forms added.
+
+:- interface.
+
+:- func pqueue__init = pqueue(_K, _V).
+
+:- func pqueue__insert(pqueue(K, V), K, V) = pqueue(K, V).
+
+:- func pqueue__to_assoc_list(pqueue(K, V)) = assoc_list(K, V).
+
+:- func pqueue__assoc_list_to_pqueue(assoc_list(K, V)) = pqueue(K, V).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+pqueue__init = PQ :-
+	pqueue__init(PQ).
+
+pqueue__insert(PQ1, K, V) = PQ2 :-
+	pqueue__insert(PQ1, K, V, PQ2).
+
+pqueue__to_assoc_list(PQ) = AL :-
+	pqueue__to_assoc_list(PQ, AL).
+
+pqueue__assoc_list_to_pqueue(AL) = PQ2 :-
+	pqueue__assoc_list_to_pqueue(AL, PQ2).
+
+
Index: queue.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/queue.m,v
retrieving revision 1.20
diff -u -d -u -r1.20 queue.m
--- queue.m	1998/09/08 01:29:51	1.20
+++ queue.m	1999/10/30 03:46:17
@@ -176,3 +176,44 @@
 	).
 
 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func queue__init = queue(T).
+
+:- func queue__put(queue(T), T) = queue(T).
+
+:- func queue__put_list(queue(T), list(T)) = queue(T).
+
+:- func queue__length(queue(T)) = int.
+
+:- func queue__list_to_queue(list(T)) = queue(T).
+
+:- func queue__delete_all(queue(T), T) = queue(T).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+queue__init = Q :-
+	queue__init(Q).
+
+queue__put(Q1, T) = Q2 :-
+	queue__put(Q1, T, Q2).
+
+queue__put_list(Q1, Xs) = Q2 :-
+	queue__put_list(Q1, Xs, Q2).
+
+queue__length(Q) = N :-
+	queue__length(Q, N).
+
+queue__list_to_queue(Xs) = Q :-
+	queue__list_to_queue(Xs, Q).
+
+queue__delete_all(Q1, T) = Q2 :-
+	queue__delete_all(Q1, T, Q2).
+
Index: rbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rbtree.m,v
retrieving revision 1.10
diff -u -d -u -r1.10 rbtree.m
--- rbtree.m	1999/03/07 23:41:03	1.10
+++ rbtree.m	1999/10/30 03:46:17
@@ -890,3 +890,65 @@
 	list__append(L0, [K0 - V0|L1], L).
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func rbtree__init = rbtree(K, V).
+
+:- func rbtree__set(rbtree(K, V), K, V) = rbtree(K, V).
+
+:- func rbtree__insert_duplicate(rbtree(K, V), K, V) = rbtree(K, V).
+
+:- func rbtree__lookup(rbtree(K, V), K) = V.
+
+:- func rbtree__delete(rbtree(K, V), K) = rbtree(K, V).
+
+:- func rbtree__keys(rbtree(K, V)) = list(K).
+
+:- func rbtree__values(rbtree(K, V)) = list(V).
+
+:- func rbtree__count(rbtree(K, V)) = int.
+
+:- func rbtree__assoc_list_to_rbtree(assoc_list(K, V)) = rbtree(K, V).
+
+:- func rbtree__rbtree_to_assoc_list(rbtree(K, V)) = assoc_list(K, V).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+rbtree__init = RBT :-
+	rbtree__init(RBT).
+
+rbtree__set(RBT1, K, V) = RBT2 :-
+	rbtree__set(RBT1, K, V, RBT2).
+
+rbtree__insert_duplicate(RBT1, K, V) = RBT2 :-
+	rbtree__insert_duplicate(RBT1, K, V, RBT2).
+
+rbtree__lookup(RBT, K) = V :-
+	rbtree__lookup(RBT, K, V).
+
+rbtree__delete(RBT1, K) = RBT2 :-
+	rbtree__delete(RBT1, K, RBT2).
+
+rbtree__keys(RBT) = Ks :-
+	rbtree__keys(RBT, Ks).
+
+rbtree__values(RBT) = Vs :-
+	rbtree__values(RBT, Vs).
+
+rbtree__count(RBT) = N :-
+	rbtree__count(RBT, N).
+
+rbtree__assoc_list_to_rbtree(AL) = RBT :-
+	rbtree__assoc_list_to_rbtree(AL, RBT).
+
+rbtree__rbtree_to_assoc_list(RBT) = AL :-
+	rbtree__rbtree_to_assoc_list(RBT, AL).
+
+
Index: relation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/relation.m,v
retrieving revision 1.23
diff -u -d -u -r1.23 relation.m
--- relation.m	1999/03/16 01:52:02	1.23
+++ relation.m	1999/10/30 03:46:17
@@ -1056,3 +1056,148 @@
 
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 30/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func relation__init = relation(T).
+
+:- func relation__lookup_element(relation(T), T) = relation_key.
+
+:- func relation__lookup_key(relation(T), relation_key) = T.
+
+:- func relation__add(relation(T), relation_key, relation_key) = relation(T).
+
+:- func relation__add_values(relation(T), T, T) = relation(T).
+
+:- func relation__add_assoc_list(relation(T), assoc_list(relation_key, relation_key)) = relation(T).
+
+:- func relation__remove(relation(T), relation_key, relation_key) = relation(T).
+
+:- func relation__remove_assoc_list(relation(T), assoc_list(relation_key, relation_key)) = relation(T).
+
+:- func relation__lookup_from(relation(T), relation_key) = set(relation_key).
+
+:- func relation__lookup_to(relation(T), relation_key) = set(relation_key).
+
+:- func relation__to_assoc_list(relation(T)) = assoc_list(T, T).
+
+:- func relation__to_key_assoc_list(relation(T)) = assoc_list(relation_key, relation_key).
+
+:- func relation__from_assoc_list(assoc_list(T, T)) = relation(T).
+
+:- func relation__domain(relation(T)) = set(T).
+
+:- func relation__inverse(relation(T)) = relation(T).
+
+:- func relation__compose(relation(T), relation(T)) = relation(T).
+
+:- func relation__dfs(relation(T), relation_key) = list(relation_key).
+
+:- func relation__dfsrev(relation(T), relation_key) = list(relation_key).
+
+:- func relation__dfs(relation(T)) = list(relation_key).
+
+:- func relation__dfsrev(relation(T)) = list(relation_key).
+
+:- func relation__components(relation(T)) = set(set(relation_key)).
+
+:- func relation__cliques(relation(T)) = set(set(relation_key)).
+
+:- func relation__reduced(relation(T)) = relation(set(T)).
+
+:- func relation__atsort(relation(T)) = list(set(T)).
+
+:- func relation__sc(relation(T)) = relation(T).
+
+:- func relation__tc(relation(T)) = relation(T).
+
+:- func relation__rtc(relation(T)) = relation(T).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+relation__init = R :-
+	relation__init(R).
+
+relation__lookup_element(R, X) = K :-
+	relation__lookup_element(R, X, K).
+
+relation__lookup_key(R, K) = X :-
+	relation__lookup_key(R, K, X).
+
+relation__add(R1, K1, K2) = R2 :-
+	relation__add(R1, K1, K2, R2).
+
+relation__add_values(R1, X, Y) = R2 :-
+	relation__add_values(R1, X, Y, R2).
+
+relation__add_assoc_list(R1, AL) = R2 :-
+	relation__add_assoc_list(R1, AL, R2).
+
+relation__remove(R1, K1, K2) = R2 :-
+	relation__remove(R1, K1, K2, R2).
+
+relation__remove_assoc_list(R1, AL) = R2 :-
+	relation__remove_assoc_list(R1, AL, R2).
+
+relation__lookup_from(R, K) = S :-
+	relation__lookup_from(R, K, S).
+
+relation__lookup_to(R, K) = S :-
+	relation__lookup_to(R, K, S).
+
+relation__to_assoc_list(R) = AL :-
+	relation__to_assoc_list(R, AL).
+
+relation__to_key_assoc_list(R) = AL :-
+	relation__to_key_assoc_list(R, AL).
+
+relation__from_assoc_list(AL) = R :-
+	relation__from_assoc_list(AL, R).
+
+relation__domain(R) = S :-
+	relation__domain(R, S).
+
+relation__inverse(R1) = R2 :-
+	relation__inverse(R1, R2).
+
+relation__compose(R1, R2) = R3 :-
+	relation__compose(R1, R2, R3).
+
+relation__dfs(R, K) = Ks :-
+	relation__dfs(R, K, Ks).
+
+relation__dfsrev(R, K) = Ks :-
+	relation__dfsrev(R, K, Ks).
+
+relation__dfs(R) = Ks :-
+	relation__dfs(R, Ks).
+
+relation__dfsrev(R) = Ks :-
+	relation__dfsrev(R, Ks).
+
+relation__components(R) = KSS :-
+	relation__components(R, KSS).
+
+relation__cliques(R) = KSS :-
+	relation__cliques(R, KSS).
+
+relation__reduced(R1) = R2 :-
+	relation__reduced(R1, R2).
+
+relation__atsort(R) = Ss :-
+	relation__atsort(R, Ss).
+
+relation__sc(R1) = R2 :-
+	relation__sc(R1, R2).
+
+relation__tc(R1) = R2 :-
+	relation__tc(R1, R2).
+
+relation__rtc(R1) = R2 :-
+	relation__rtc(R1, R2).
+
Index: set_bbbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_bbbtree.m,v
retrieving revision 1.13
diff -u -d -u -r1.13 set_bbbtree.m
--- set_bbbtree.m	1998/01/23 12:33:33	1.13
+++ set_bbbtree.m	1999/10/30 03:46:18
@@ -1196,5 +1196,101 @@
 		Set = R
 	).
 
-%------------------------------------------------------------------------------%
-%------------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cam.sri.com> 24/04/99
+%	Function forms added.
+
+:- interface.
+
+:- func set_bbbtree__list_to_set(list(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__sorted_list_to_set(list(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__to_sorted_list(set_bbbtree(T)) = list(T).
+
+:- func set_bbbtree__init = set_bbbtree(T).
+
+:- func set_bbbtree__make_singleton_set(T) = set_bbbtree(T).
+
+:- func set_bbbtree__insert(set_bbbtree(T), T) = set_bbbtree(T).
+
+:- func set_bbbtree__insert_list(set_bbbtree(T), list(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__delete(set_bbbtree(T), T) = set_bbbtree(T).
+
+:- func set_bbbtree__delete_list(set_bbbtree(T), list(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__union(set_bbbtree(T), set_bbbtree(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__power_union(set_bbbtree(set_bbbtree(T))) = set_bbbtree(T).
+
+:- func set_bbbtree__intersect(set_bbbtree(T), set_bbbtree(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__power_intersect(set_bbbtree(set_bbbtree(T))) = set_bbbtree(T).
+
+:- func set_bbbtree__difference(set_bbbtree(T), set_bbbtree(T)) = set_bbbtree(T).
+
+:- func set_bbbtree__map(func(T1) = T2, set_bbbtree(T1)) = set_bbbtree(T2).
+
+:- func set_bbbtree__filter_map(func(T1) = T2, set_bbbtree(T1)) = set_bbbtree(T2).
+:- mode set_bbbtree__filter_map(func(in) = out is semidet, in) = out is det.
+
+:- func set_bbbtree__fold(func(T1, T2) = T2, set_bbbtree(T1), T2) = T2.
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+set_bbbtree__list_to_set(Xs) = S :-
+	set_bbbtree__list_to_set(Xs, S).
+
+set_bbbtree__sorted_list_to_set(Xs) = S :-
+	set_bbbtree__sorted_list_to_set(Xs, S).
+
+set_bbbtree__to_sorted_list(S) = Xs :-
+	set_bbbtree__to_sorted_list(S, Xs).
+
+set_bbbtree__init = S :-
+	set_bbbtree__init(S).
+
+set_bbbtree__make_singleton_set(T) = S :-
+	set_bbbtree__singleton_set(S, T).
+
+set_bbbtree__insert(S1, T) = S2 :-
+	set_bbbtree__insert(S1, T, S2).
+
+set_bbbtree__insert_list(S1, Xs) = S2 :-
+	set_bbbtree__insert_list(S1, Xs, S2).
+
+set_bbbtree__delete(S1, T) = S2 :-
+	set_bbbtree__delete(S1, T, S2).
+
+set_bbbtree__delete_list(S1, Xs) = S2 :-
+	set_bbbtree__delete_list(S1, Xs, S2).
+
+set_bbbtree__union(S1, S2) = S3 :-
+	set_bbbtree__union(S1, S2, S3).
+
+set_bbbtree__power_union(SS) = S :-
+	set_bbbtree__power_union(SS, S).
+
+set_bbbtree__intersect(S1, S2) = S3 :-
+	set_bbbtree__intersect(S1, S2, S3).
+
+set_bbbtree__power_intersect(SS) = S :-
+	set_bbbtree__power_intersect(SS, S).
+
+set_bbbtree__difference(S1, S2) = S3 :-
+	set_bbbtree__difference(S1, S2, S3).
+
+set_bbbtree__map(F, S1) = S2 :-
+	S2 = set_bbbtree__list_to_set(list__map(F, set_bbbtree__to_sorted_list(S1))).
+
+set_bbbtree__filter_map(PF, S1) = S2 :-
+	S2 = set_bbbtree__list_to_set(list__filter_map(PF, set_bbbtree__to_sorted_list(S1))).
+
+set_bbbtree__fold(F, S, A) = B :-
+	B = list__foldl(F, set_bbbtree__to_sorted_list(S), A).
+
Index: set_ordlist.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_ordlist.m,v
retrieving revision 1.8
diff -u -d -u -r1.8 set_ordlist.m
--- set_ordlist.m	1998/01/23 12:33:34	1.8
+++ set_ordlist.m	1999/10/30 03:46:18
@@ -349,3 +349,105 @@
 	list__length(Set, Count).
 
 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cam.sri.com> 24/04/99
+%	Function forms added.
+
+:- interface.
+
+:- func set_ordlist__list_to_set(list(T)) = set_ordlist(T).
+
+:- func set_ordlist__sorted_list_to_set(list(T)) = set_ordlist(T).
+
+:- func set_ordlist__to_sorted_list(set_ordlist(T)) = list(T).
+
+:- func set_ordlist__init = set_ordlist(T).
+
+:- func set_ordlist__make_singleton_set(T) = set_ordlist(T).
+
+:- func set_ordlist__insert(set_ordlist(T), T) = set_ordlist(T).
+
+:- func set_ordlist__insert_list(set_ordlist(T), list(T)) = set_ordlist(T).
+
+:- func set_ordlist__delete(set_ordlist(T), T) = set_ordlist(T).
+
+:- func set_ordlist__delete_list(set_ordlist(T), list(T)) = set_ordlist(T).
+
+:- func set_ordlist__union(set_ordlist(T), set_ordlist(T)) = set_ordlist(T).
+
+:- func set_ordlist__power_union(set_ordlist(set_ordlist(T))) = set_ordlist(T).
+
+:- func set_ordlist__intersect(set_ordlist(T), set_ordlist(T)) = set_ordlist(T).
+
+:- func set_ordlist__power_intersect(set_ordlist(set_ordlist(T))) = set_ordlist(T).
+
+:- func set_ordlist__difference(set_ordlist(T), set_ordlist(T)) = set_ordlist(T).
+
+:- func set_ordlist__count(set_ordlist(T)) = int.
+
+:- func set_ordlist__map(func(T1) = T2, set_ordlist(T1)) = set_ordlist(T2).
+
+:- func set_ordlist__filter_map(func(T1) = T2, set_ordlist(T1)) = set_ordlist(T2).
+:- mode set_ordlist__filter_map(func(in) = out is semidet, in) = out is det.
+
+:- func set_ordlist__fold(func(T1, T2) = T2, set_ordlist(T1), T2) = T2.
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+set_ordlist__list_to_set(Xs) = S :-
+	set_ordlist__list_to_set(Xs, S).
+
+set_ordlist__sorted_list_to_set(Xs) = S :-
+	set_ordlist__sorted_list_to_set(Xs, S).
+
+set_ordlist__to_sorted_list(S) = Xs :-
+	set_ordlist__to_sorted_list(S, Xs).
+
+set_ordlist__init = S :-
+	set_ordlist__init(S).
+
+set_ordlist__make_singleton_set(T) = S :-
+	set_ordlist__singleton_set(S, T).
+
+set_ordlist__insert(S1, T) = S2 :-
+	set_ordlist__insert(S1, T, S2).
+
+set_ordlist__insert_list(S1, Xs) = S2 :-
+	set_ordlist__insert_list(S1, Xs, S2).
+
+set_ordlist__delete(S1, T) = S2 :-
+	set_ordlist__delete(S1, T, S2).
+
+set_ordlist__delete_list(S1, Xs) = S2 :-
+	set_ordlist__delete_list(S1, Xs, S2).
+
+set_ordlist__union(S1, S2) = S3 :-
+	set_ordlist__union(S1, S2, S3).
+
+set_ordlist__power_union(SS) = S :-
+	set_ordlist__power_union(SS, S).
+
+set_ordlist__intersect(S1, S2) = S3 :-
+	set_ordlist__intersect(S1, S2, S3).
+
+set_ordlist__power_intersect(SS) = S :-
+	set_ordlist__power_intersect(SS, S).
+
+set_ordlist__difference(S1, S2) = S3 :-
+	set_ordlist__difference(S1, S2, S3).
+
+set_ordlist__count(S) = N :-
+	set_ordlist__count(S, N).
+
+set_ordlist__map(F, S1) = S2 :-
+	S2 = set_ordlist__list_to_set(list__map(F, set_ordlist__to_sorted_list(S1))).
+
+set_ordlist__filter_map(PF, S1) = S2 :-
+	S2 = set_ordlist__list_to_set(list__filter_map(PF, set_ordlist__to_sorted_list(S1))).
+
+set_ordlist__fold(F, S, A) = B :-
+	B = list__foldl(F, set_ordlist__to_sorted_list(S), A).
+
Index: set_unordlist.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_unordlist.m,v
retrieving revision 1.14
diff -u -d -u -r1.14 set_unordlist.m
--- set_unordlist.m	1999/03/15 08:48:09	1.14
+++ set_unordlist.m	1999/10/30 03:46:18
@@ -306,3 +306,100 @@
 	set_unordlist__difference_2(Es, B, C).
 
 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cam.sri.com> 24/04/99
+%	Function forms added.
+
+:- interface.
+
+:- func set_unordlist__list_to_set(list(T)) = set_unordlist(T).
+
+:- func set_unordlist__sorted_list_to_set(list(T)) = set_unordlist(T).
+
+:- func set_unordlist__to_sorted_list(set_unordlist(T)) = list(T).
+
+:- func set_unordlist__init = set_unordlist(T).
+
+:- func set_unordlist__make_singleton_set(T) = set_unordlist(T).
+
+:- func set_unordlist__insert(set_unordlist(T), T) = set_unordlist(T).
+
+:- func set_unordlist__insert_list(set_unordlist(T), list(T)) = set_unordlist(T).
+
+:- func set_unordlist__delete(set_unordlist(T), T) = set_unordlist(T).
+
+:- func set_unordlist__delete_list(set_unordlist(T), list(T)) = set_unordlist(T).
+
+:- func set_unordlist__union(set_unordlist(T), set_unordlist(T)) = set_unordlist(T).
+
+:- func set_unordlist__power_union(set_unordlist(set_unordlist(T))) = set_unordlist(T).
+
+:- func set_unordlist__intersect(set_unordlist(T), set_unordlist(T)) = set_unordlist(T).
+
+:- func set_unordlist__power_intersect(set_unordlist(set_unordlist(T))) = set_unordlist(T).
+
+:- func set_unordlist__difference(set_unordlist(T), set_unordlist(T)) = set_unordlist(T).
+
+:- func set_unordlist__map(func(T1) = T2, set_unordlist(T1)) = set_unordlist(T2).
+
+:- func set_unordlist__filter_map(func(T1) = T2, set_unordlist(T1)) = set_unordlist(T2).
+:- mode set_unordlist__filter_map(func(in) = out is semidet, in) = out is det.
+
+:- func set_unordlist__fold(func(T1, T2) = T2, set_unordlist(T1), T2) = T2.
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+set_unordlist__list_to_set(Xs) = S :-
+	set_unordlist__list_to_set(Xs, S).
+
+set_unordlist__sorted_list_to_set(Xs) = S :-
+	set_unordlist__sorted_list_to_set(Xs, S).
+
+set_unordlist__to_sorted_list(S) = Xs :-
+	set_unordlist__to_sorted_list(S, Xs).
+
+set_unordlist__init = S :-
+	set_unordlist__init(S).
+
+set_unordlist__make_singleton_set(T) = S :-
+	set_unordlist__singleton_set(S, T).
+
+set_unordlist__insert(S1, T) = S2 :-
+	set_unordlist__insert(S1, T, S2).
+
+set_unordlist__insert_list(S1, Xs) = S2 :-
+	set_unordlist__insert_list(S1, Xs, S2).
+
+set_unordlist__delete(S1, T) = S2 :-
+	set_unordlist__delete(S1, T, S2).
+
+set_unordlist__delete_list(S1, Xs) = S2 :-
+	set_unordlist__delete_list(S1, Xs, S2).
+
+set_unordlist__union(S1, S2) = S3 :-
+	set_unordlist__union(S1, S2, S3).
+
+set_unordlist__power_union(SS) = S :-
+	set_unordlist__power_union(SS, S).
+
+set_unordlist__intersect(S1, S2) = S3 :-
+	set_unordlist__intersect(S1, S2, S3).
+
+set_unordlist__power_intersect(SS) = S :-
+	set_unordlist__power_intersect(SS, S).
+
+set_unordlist__difference(S1, S2) = S3 :-
+	set_unordlist__difference(S1, S2, S3).
+
+set_unordlist__map(F, S1) = S2 :-
+	S2 = set_unordlist__list_to_set(list__map(F, set_unordlist__to_sorted_list(S1))).
+
+set_unordlist__filter_map(PF, S1) = S2 :-
+	S2 = set_unordlist__list_to_set(list__filter_map(PF, set_unordlist__to_sorted_list(S1))).
+
+set_unordlist__fold(F, S, A) = B :-
+	B = list__foldl(F, set_unordlist__to_sorted_list(S), A).
+
Index: stack.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/stack.m,v
retrieving revision 1.16
diff -u -d -u -r1.16 stack.m
--- stack.m	1999/06/06 05:08:27	1.16
+++ stack.m	1999/10/30 03:46:18
@@ -127,3 +127,40 @@
 	list__length(Stack, Depth).
 
 %--------------------------------------------------------------------------%
+%--------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func stack__init = stack(T).
+
+:- func stack__push(stack(T), T) = stack(T).
+
+:- func stack__push_list(stack(T), list(T)) = stack(T).
+
+:- func stack__top_det(stack(T)) = T.
+
+:- func stack__depth(stack(T)) = int.
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+stack__init = S :-
+	stack__init(S).
+
+stack__push(S1, X) = S2 :-
+	stack__push(S1, X, S2).
+
+stack__push_list(S1, Xs) = S2 :-
+	stack__push_list(S1, Xs, S2).
+
+stack__top_det(S) = X :-
+	stack__top_det(S, X).
+
+stack__depth(S) = N :-
+	stack__depth(S, N).
+
+
Index: term.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/term.m,v
retrieving revision 1.91
diff -u -d -u -r1.91 term.m
--- term.m	1999/10/21 03:58:45	1.91
+++ term.m	1999/10/30 03:46:18
@@ -1088,3 +1088,165 @@
 
 term__coerce_var_supply(var_supply(Supply), var_supply(Supply)).
 
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 30/04/99
+% 	Function forms added.
+
+:- interface.
+
+:- func term__context_init = term__context.
+
+:- func term__init_var_supply = var_supply(T).
+
+:- func term__try_term_to_type(term(U)) = term_to_type_result(T, U).
+
+:- func term__det_term_to_type(term(_)) = T.
+
+:- func term__type_to_term(T) = term(_).
+
+:- func term__univ_to_term(univ) = term(_).
+
+:- func term__vars(term(T)) = list(var(T)).
+
+:- func term__vars_2(term(T), list(var(T))) = list(var(T)).
+
+:- func term__vars_list(list(term(T))) = list(var(T)).
+
+:- func term__substitute(term(T), var(T), term(T)) = term(T).
+
+:- func term__substitute_list(list(term(T)), var(T), term(T)) = list(term(T)).
+
+:- func term__substitute_corresponding(list(var(T)), list(term(T)), term(T)) = term(T).
+
+:- func term__substitute_corresponding_list(list(var(T)), list(term(T)), list(term(T))) = list(term(T)).
+
+:- func term__apply_rec_substitution(term(T), substitution(T)) = term(T).
+
+:- func term__apply_rec_substitution_to_list(list(term(T)), substitution(T)) = list(term(T)).
+
+:- func term__apply_substitution(term(T), substitution(T)) = term(T).
+
+:- func term__apply_substitution_to_list(list(term(T)), substitution(T)) = list(term(T)).
+
+:- func term__relabel_variable(term(T), var(T), var(T)) = term(T).
+
+:- func term__relabel_variables(list(term(T)), var(T), var(T)) = list(term(T)).
+
+:- func term__apply_variable_renaming(term(T), map(var(T), var(T))) = term(T).
+
+:- func term__apply_variable_renaming_to_list(list(term(T)), map(var(T), var(T))) = list(term(T)).
+
+:- func term__var_to_int(var(T)) = int.
+
+:- func term__context_line(term__context) = int.
+
+:- func term__context_file(term__context) = string.
+
+:- func term__context_init(string, int) = term__context.
+
+:- func term__term_list_to_var_list(list(term(T))) = list(var(T)).
+
+:- func term__var_list_to_term_list(list(var(T))) = list(term(T)).
+
+:- func term__coerce(term(T)) = term(U).
+
+:- func term__coerce_var(var(T)) = var(U).
+
+:- func term__coerce_var_supply(var_supply(T)) = var_supply(U).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+term__context_init = C :-
+	term__context_init(C).
+
+term__init_var_supply = VS :-
+	term__init_var_supply(VS).
+
+term__try_term_to_type(T) = TTTR :-
+	term__try_term_to_type(T, TTTR).
+
+term__det_term_to_type(T1) = T2 :-
+	term__det_term_to_type(T1, T2).
+
+term__type_to_term(T1) = T2 :-
+	term__type_to_term(T1, T2).
+
+term__univ_to_term(U) = T :-
+	term__univ_to_term(U, T).
+
+term__vars(T) = Vs :-
+	term__vars(T, Vs).
+
+term__vars_2(T, Vs1) = Vs2 :-
+	term__vars_2(T, Vs1, Vs2).
+
+term__vars_list(Ts) = Vs :-
+	term__vars_list(Ts, Vs).
+
+term__substitute(T1, V, T2) = T3 :-
+	term__substitute(T1, V, T2, T3).
+
+term__substitute_list(Ts1, V, T) = Ts2 :-
+	term__substitute_list(Ts1, V, T, Ts2).
+
+term__substitute_corresponding(Vs, T1s, T) = T2 :-
+	term__substitute_corresponding(Vs, T1s, T, T2).
+
+term__substitute_corresponding_list(Vs, Ts1, Ts2) = Ts3 :-
+	term__substitute_corresponding_list(Vs, Ts1, Ts2, Ts3).
+
+term__apply_rec_substitution(T1, S) = T2 :-
+	term__apply_rec_substitution(T1, S, T2).
+
+term__apply_rec_substitution_to_list(Ts1, S) = Ts2 :-
+	term__apply_rec_substitution_to_list(Ts1, S, Ts2).
+
+term__apply_substitution(T1, S) = T2 :-
+	term__apply_substitution(T1, S, T2).
+
+term__apply_substitution_to_list(Ts1, S) = Ts2 :-
+	term__apply_substitution_to_list(Ts1, S, Ts2).
+
+term__relabel_variable(T1, V1, V2) = T2 :-
+	term__relabel_variable(T1, V1, V2, T2).
+
+term__relabel_variables(Ts1, V1, V2) = Ts2 :-
+	term__relabel_variables(Ts1, V1, V2, Ts2).
+
+term__apply_variable_renaming(T1, M) = T2 :-
+	term__apply_variable_renaming(T1, M, T2).
+
+term__apply_variable_renaming_to_list(Ts1, M) = Ts2 :-
+	term__apply_variable_renaming_to_list(Ts1, M, Ts2).
+
+term__var_to_int(V) = N :-
+	term__var_to_int(V, N).
+
+term__context_line(C) = N :-
+	term__context_line(C, N).
+
+term__context_file(C) = S :-
+	term__context_file(C, S).
+
+term__context_init(S, N) = C :-
+	term__context_init(S, N, C).
+
+term__term_list_to_var_list(Ts) = Vs :-
+	term__term_list_to_var_list(Ts, Vs).
+
+term__var_list_to_term_list(Vs) = Ts :-
+	term__var_list_to_term_list(Vs, Ts).
+
+term__coerce(T1) = T2 :-
+	term__coerce(T1, T2).
+
+term__coerce_var(V1) = V2 :-
+	term__coerce_var(V1, V2).
+
+term__coerce_var_supply(VS1) = VS2 :-
+	term__coerce_var_supply(VS1, VS2).
+
Index: tree234.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.26
diff -u -d -u -r1.26 tree234.m
--- tree234.m	1999/03/07 23:41:05	1.26
+++ tree234.m	1999/10/30 03:46:19
@@ -2472,3 +2472,70 @@
 
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 30/04/99
+%       Function forms added.
+
+:- interface.
+
+:- func tree234__init = tree234(K, V).
+
+:- func tree234__lookup(tree234(K, V), K) = V.
+
+:- func tree234__set(tree234(K, V), K, V) = tree234(K, V).
+
+:- func tree234__delete(tree234(K, V), K) = tree234(K, V).
+
+:- func tree234__keys(tree234(K, V)) = list(K).
+
+:- func tree234__values(tree234(K, V)) = list(V).
+
+:- func tree234__count(tree234(K, V)) = int.
+
+:- func tree234__assoc_list_to_tree234(assoc_list(K, V)) = tree234(K, V).
+
+:- func tree234__tree234_to_assoc_list(tree234(K, V)) = assoc_list(K, V).
+
+:- func tree234__foldl(func(K, V, T) = T, tree234(K, V), T) = T.
+
+:- func tree234__map_values(func(K, V) = W, tree234(K, V)) = tree234(K, W).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+tree234__init = T :-
+	tree234__init(T).
+
+tree234__lookup(T, K) = V :-
+	tree234__lookup(T, K, V).
+
+tree234__set(T1, K, V) = T2 :-
+	tree234__set(T1, K, V, T2).
+
+tree234__delete(T1, K) = T2 :-
+	tree234__delete(T1, K, T2).
+
+tree234__keys(T) = Ks :-
+	tree234__keys(T, Ks).
+
+tree234__values(T) = Vs :-
+	tree234__values(T, Vs).
+
+tree234__count(T) = N :-
+	tree234__count(T, N).
+
+tree234__assoc_list_to_tree234(AL) = T :-
+	tree234__assoc_list_to_tree234(AL, T).
+
+tree234__tree234_to_assoc_list(T) = AL :-
+	tree234__tree234_to_assoc_list(T, AL).
+
+tree234__foldl(F, T, A) = B :-
+	P = ( pred(W::in, X::in, Y::in, Z::out) is det :- Z = F(W, X, Y) ),
+	tree234__foldl(P, T, A, B).
+
+tree234__map_values(F, T1) = T2 :-
+	P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+	tree234__map_values(P, T1, T2).
+
Index: varset.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/varset.m,v
retrieving revision 1.61
diff -u -d -u -r1.61 varset.m
--- varset.m	1999/10/03 04:17:12	1.61
+++ varset.m	1999/10/30 03:46:19
@@ -555,3 +555,98 @@
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
+% Ralph Becket <rwab1 at cl.cam.ac.uk> 30/04/99
+%	Function forms added.
+
+:- interface.
+
+:- func varset__init = varset(T).
+
+:- func varset__delete_var(varset(T), var(T)) = varset(T).
+
+:- func varset__delete_vars(varset(T), list(var(T))) = varset(T).
+
+:- func varset__vars(varset(T)) = list(var(T)).
+
+:- func varset__name_var(varset(T), var(T), string) = varset(T).
+
+:- func varset__lookup_name(varset(T), var(T)) = string.
+
+:- func varset__lookup_name(varset(T), var(T), string) = string.
+
+:- func varset__bind_var(varset(T), var(T), term(T)) = varset(T).
+
+:- func varset__bind_vars(varset(T), substitution(T)) = varset(T).
+
+:- func varset__lookup_vars(varset(T)) = substitution(T).
+
+:- func varset__get_bindings(varset(T)) = substitution(T).
+
+:- func varset__set_bindings(varset(T), substitution(T)) = varset(T).
+
+:- func varset__create_name_var_map(varset(T)) = map(string, var(T)).
+
+:- func varset__var_name_list(varset(T)) = assoc_list(var(T), string).
+
+:- func varset__ensure_unique_names(list(var(T)), string, varset(T)) = varset(T).
+
+:- func varset__select(varset(T), set(var(T))) = varset(T).
+
+:- func varset__coerce(varset(T)) = varset(U).
+
+% ---------------------------------------------------------------------------- %
+% ---------------------------------------------------------------------------- %
+
+:- implementation.
+
+varset__init = VS :-
+	varset__init(VS).
+
+varset__delete_var(VS1, V) = VS2 :-
+	varset__delete_var(VS1, V, VS2).
+
+varset__delete_vars(VS1, Vs) = VS2 :-
+	varset__delete_vars(VS1, Vs, VS2).
+
+varset__vars(VS) = Vs :-
+	varset__vars(VS, Vs).
+
+varset__name_var(VS1, V, S) = VS2 :-
+	varset__name_var(VS1, V, S, VS2).
+
+varset__lookup_name(VS, V) = S :-
+	varset__lookup_name(VS, V, S).
+
+varset__lookup_name(VS1, V, S) = S2 :-
+	varset__lookup_name(VS1, V, S, S2).
+
+varset__bind_var(VS1, V, T) = VS2 :-
+	varset__bind_var(VS1, V, T, VS2).
+
+varset__bind_vars(VS1, S) = VS2 :-
+	varset__bind_vars(VS1, S, VS2).
+
+varset__lookup_vars(VS) = S :-
+	varset__lookup_vars(VS, S).
+
+varset__get_bindings(VS) = S :-
+	varset__get_bindings(VS, S).
+
+varset__set_bindings(VS1, S) = VS2 :-
+	varset__set_bindings(VS1, S, VS2).
+
+varset__create_name_var_map(VS) = M :-
+	varset__create_name_var_map(VS, M).
+
+varset__var_name_list(VS) = AL :-
+	varset__var_name_list(VS, AL).
+
+varset__ensure_unique_names(Vs, S1, VS1) = VS2 :-
+	varset__ensure_unique_names(Vs, S1, VS1, VS2).
+
+varset__select(VS1, S) = VS2 :-
+	varset__select(VS1, S, VS2).
+
+varset__coerce(VS1) = VS2 :-
+	varset__coerce(VS1, VS2).
+
--------------------------------------------------------------------------
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