[m-rev.] New modes for unsorted_aggregate
Ralph Becket
rafe at cs.mu.OZ.AU
Wed Jul 6 13:45:38 AEST 2005
I spotted these missing modes when implementing branch-and-bound for
Neng-Fa.
Estimated hours taken: 0.2
Branches: main, release
library/std_util.m:
Added cc_multi options to the accumulator pred argument of
unsorted_aggregate.
Fixed up some comment formatting.
Index: std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.299
diff -u -r1.299 std_util.m
--- std_util.m 16 Jun 2005 04:08:04 -0000 1.299
+++ std_util.m 6 Jul 2005 03:36:26 -0000
@@ -168,14 +168,13 @@
%-----------------------------------------------------------------------------%
-% solutions/2 collects all the solutions to a predicate and
-% returns them as a list in sorted order, with duplicates removed.
-% solutions_set/2 returns them as a set.
-% unsorted_solutions/2 returns them as an unsorted list with possible
-% duplicates; since there are an infinite number of such lists,
-% this must be called from a context in which only a single solution
-% is required.
-
+ % solutions/2 collects all the solutions to a predicate and returns
+ % them as a list in sorted order, with duplicates removed.
+ % solutions_set/2 returns them as a set. unsorted_solutions/2 returns
+ % them as an unsorted list with possible duplicates; since there are an
+ % infinite number of such lists, this must be called from a context in
+ % which only a single solution is required.
+ %
:- pred solutions(pred(T), list(T)).
:- mode solutions(pred(out) is multi, out(non_empty_list)) is det.
:- mode solutions(pred(out) is nondet, out) is det.
@@ -213,7 +212,6 @@
% solutions(Generator, Solutions),
% list__foldl(Accumulator, Solutions, Acc0, Acc).
%
-
:- pred aggregate(pred(T), pred(T, U, U), U, U).
:- mode aggregate(pred(out) is multi, pred(in, in, out) is det,
in, out) is det.
@@ -232,7 +230,6 @@
% solutions(Generator, Solutions),
% list__foldl2(Accumulator, Solutions, AccA0, AccA, AccB0, AccB).
%
-
:- pred aggregate2(pred(T), pred(T, U, U, V, V), U, U, V, V).
:- mode aggregate2(pred(out) is multi, pred(in, in, out, in, out) is det,
in, out, in, out) is det.
@@ -254,10 +251,12 @@
% Operationally, however, unsorted_aggregate/4 will call the
% Accumulator for each solution as it is obtained, rather than
% first building a list of all the solutions.
-
+ %
:- pred unsorted_aggregate(pred(T), pred(T, U, U), U, U).
:- mode unsorted_aggregate(pred(out) is multi, pred(in, in, out) is det,
in, out) is cc_multi.
+:- mode unsorted_aggregate(pred(out) is multi, pred(in, in, out) is cc_multi,
+ in, out) is cc_multi.
:- mode unsorted_aggregate(pred(out) is multi, pred(in, di, uo) is det,
di, uo) is cc_multi.
:- mode unsorted_aggregate(pred(out) is multi, pred(in, di, uo) is cc_multi,
@@ -269,6 +268,8 @@
:- mode unsorted_aggregate(pred(out) is nondet, pred(in, di, uo) is cc_multi,
di, uo) is cc_multi.
:- mode unsorted_aggregate(pred(out) is nondet, pred(in, in, out) is det,
+ in, out) is cc_multi.
+:- mode unsorted_aggregate(pred(out) is nondet, pred(in, in, out) is cc_multi,
in, out) is cc_multi.
:- mode unsorted_aggregate(pred(muo) is nondet, pred(mdi, di, uo) is det,
di, uo) is cc_multi.
--------------------------------------------------------------------------
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