[m-rev.] diff: set foldl vs fold

Zoltan Somogyi zs at unimelb.edu.au
Tue Jun 26 23:11:13 AEST 2012


library/set.m:
library/set_ordlist.m:
library/set_tree234.m:
	Add foldl, foldl2, ... foldl6 as synonyms for fold, fold2, ... fold6.
	This allows set_of_var.m to switch from tree_bitset.m to using these
	modules with just e.g. g/MODULE/s/tree_bitset/set_tree234/g.

compiler/set_of_var.m:
	Change the code to resolve an ambiguity that would otherwise arise
	after such a substitution.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/set_of_var.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/set_of_var.m,v
retrieving revision 1.7
diff -u -b -r1.7 set_of_var.m
--- compiler/set_of_var.m	24 Apr 2012 09:18:24 -0000	1.7
+++ compiler/set_of_var.m	26 Jun 2012 13:01:17 -0000
@@ -309,16 +309,18 @@
     tree_bitset.divide_by_set(DivideBySet, Set, InPart, OutPart).   % MODULE
 
 cartesian_product(A, B, Product) :-
-    fold(cartesian_product2(A), B, [], Product).
+    tree_bitset.foldl(cartesian_product2(A), B, [], Product).       % MODULE
 
 :- pred cartesian_product2(set_of_var(T)::in, var(T)::in,
     list(set_of_var(T))::in, list(set_of_var(T))::out) is det.
 
 cartesian_product2(SetA, VarB, !Sets) :-
-    set_of_var.fold((pred(VarA::in, SetsI0::in, SetsI::out) is det :-
+    Pred =
+        (pred(VarA::in, SetsI0::in, SetsI::out) is det :-
             Set = set_of_var.list_to_set([VarA, VarB]),
             SetsI = [Set | SetsI0]
-        ), SetA, !Sets).
+        ),
+    set_of_var.fold(Pred, SetA, !Sets).
 
 cartesian_product_list([], []).
 cartesian_product_list([FirstSet | OtherSets], Product) :-
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glfw
cvs diff: Diffing extras/graphics/mercury_glfw/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/set.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set.m,v
retrieving revision 1.99
diff -u -b -r1.99 set.m
--- library/set.m	24 Apr 2012 09:18:29 -0000	1.99
+++ library/set.m	26 Jun 2012 13:01:18 -0000
@@ -279,6 +279,7 @@
     %   list.foldl(F, to_sorted_list(S), A).
     %
 :- func set.fold(func(T, A) = A, set(T), A) = A.
+:- func set.foldl(func(T, A) = A, set(T), A) = A.
 
 :- pred set.fold(pred(T, A, A), set(T), A, A).
 :- mode set.fold(pred(in, in, out) is det, in, in, out) is det.
@@ -288,6 +289,14 @@
 :- mode set.fold(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
 :- mode set.fold(pred(in, di, uo) is semidet, in, di, uo) is semidet.
 
+:- pred set.foldl(pred(T, A, A), set(T), A, A).
+:- mode set.foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode set.foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode set.foldl(pred(in, di, uo) is det, in, di, uo) is det.
+:- mode set.foldl(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode set.foldl(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode set.foldl(pred(in, di, uo) is semidet, in, di, uo) is semidet.
+
 :- pred set.fold2(pred(T, A, A, B, B), set(T), A, A, B, B).
 :- mode set.fold2(pred(in, in, out, in, out) is det, in,
     in, out, in, out) is det.
@@ -302,6 +311,20 @@
 :- mode set.fold2(pred(in, in, out, di, uo) is semidet,
     in, in, out, di, uo) is semidet.
 
+:- pred set.foldl2(pred(T, A, A, B, B), set(T), A, A, B, B).
+:- mode set.foldl2(pred(in, in, out, in, out) is det, in,
+    in, out, in, out) is det.
+:- mode set.foldl2(pred(in, in, out, mdi, muo) is det, in,
+    in, out, mdi, muo) is det.
+:- mode set.foldl2(pred(in, in, out, di, uo) is det, in,
+    in, out, di, uo) is det.
+:- mode set.foldl2(pred(in, in, out, in, out) is semidet,
+    in, in, out, in, out) is semidet.
+:- mode set.foldl2(pred(in, in, out, mdi, muo) is semidet,
+    in, in, out, mdi, muo) is semidet.
+:- mode set.foldl2(pred(in, in, out, di, uo) is semidet,
+    in, in, out, di, uo) is semidet.
+
 :- pred set.fold3(pred(T, A, A, B, B, C, C), set(T), A, A, B, B, C, C).
 :- mode set.fold3(pred(in, in, out, in, out, in, out) is det, in,
     in, out, in, out, in, out) is det.
@@ -316,6 +339,20 @@
 :- mode set.fold3(pred(in, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, di, uo) is semidet.
 
+:- pred set.foldl3(pred(T, A, A, B, B, C, C), set(T), A, A, B, B, C, C).
+:- mode set.foldl3(pred(in, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out) is det.
+:- mode set.foldl3(pred(in, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, mdi, muo) is det.
+:- mode set.foldl3(pred(in, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, di, uo) is det.
+:- mode set.foldl3(pred(in, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out) is semidet.
+:- mode set.foldl3(pred(in, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, mdi, muo) is semidet.
+:- mode set.foldl3(pred(in, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, di, uo) is semidet.
+
 :- pred set.fold4(pred(T, A, A, B, B, C, C, D, D), set(T), A, A, B, B,
     C, C, D, D).
 :- mode set.fold4(pred(in, in, out, in, out, in, out, in, out) is det, in,
@@ -331,6 +368,21 @@
 :- mode set.fold4(pred(in, in, out, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set.foldl4(pred(T, A, A, B, B, C, C, D, D), set(T), A, A, B, B,
+    C, C, D, D).
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out, in, out) is det.
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, in, out, mdi, muo) is det.
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, in, out, di, uo) is det.
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out, in, out) is semidet.
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set.foldl4(pred(in, in, out, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set.fold5(pred(T, A, A, B, B, C, C, D, D, E, E), set(T), A, A, B, B,
     C, C, D, D, E, E).
 :- mode set.fold5(
@@ -352,6 +404,27 @@
     pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set.foldl5(pred(T, A, A, B, B, C, C, D, D, E, E), set(T), A, A, B, B,
+    C, C, D, D, E, E).
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set.fold6(pred(T, A, A, B, B, C, C, D, D, E, E, F, F), set(T),
     A, A, B, B, C, C, D, D, E, E, F, F).
 :- mode set.fold6(
@@ -373,6 +446,27 @@
     pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set.foldl6(pred(T, A, A, B, B, C, C, D, D, E, E, F, F), set(T),
+    A, A, B, B, C, C, D, D, E, E, F, F).
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
+
     % all_true(Pred, Set) succeeds iff Pred(Element) succeeds
     % for all the elements of Set.
     %
@@ -610,24 +704,45 @@
     set_ordlist.filter_map(P, Set, TransformedTrueSet).
 
 set.fold(F, S, A) =
+    set.foldl(F, S, A).
+
+set.foldl(F, S, A) =
     set_ordlist.fold(F, S, A).
 
 set.fold(F, S, !A) :-
+    set.foldl(F, S, !A).
+
+set.foldl(F, S, !A) :-
     set_ordlist.fold(F, S, !A).
 
 set.fold2(F, S, !A, !B) :-
+    set.foldl2(F, S, !A, !B).
+
+set.foldl2(F, S, !A, !B) :-
     set_ordlist.fold2(F, S, !A, !B).
 
 set.fold3(F, S, !A, !B, !C) :-
+    set.foldl3(F, S, !A, !B, !C).
+
+set.foldl3(F, S, !A, !B, !C) :-
     set_ordlist.fold3(F, S, !A, !B, !C).
 
 set.fold4(F, S, !A, !B, !C, !D) :-
+    set.foldl4(F, S, !A, !B, !C, !D).
+
+set.foldl4(F, S, !A, !B, !C, !D) :-
     set_ordlist.fold4(F, S, !A, !B, !C, !D).
 
 set.fold5(F, S, !A, !B, !C, !D, !E) :-
+    set.foldl5(F, S, !A, !B, !C, !D, !E).
+
+set.foldl5(F, S, !A, !B, !C, !D, !E) :-
     set_ordlist.fold5(F, S, !A, !B, !C, !D, !E).
 
 set.fold6(F, S, !A, !B, !C, !D, !E, !F) :-
+    set.foldl6(F, S, !A, !B, !C, !D, !E, !F).
+
+set.foldl6(F, S, !A, !B, !C, !D, !E, !F) :-
     set_ordlist.fold6(F, S, !A, !B, !C, !D, !E, !F).
 
 set.all_true(P, S) :-
Index: library/set_ordlist.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_ordlist.m,v
retrieving revision 1.45
diff -u -b -r1.45 set_ordlist.m
--- library/set_ordlist.m	24 Apr 2012 09:18:29 -0000	1.45
+++ library/set_ordlist.m	26 Jun 2012 13:01:18 -0000
@@ -267,6 +267,18 @@
 :- mode set_ordlist.fold(pred(in, di, uo) is semidet, in, di, uo)
     is semidet.
 
+:- func set_ordlist.foldl(func(T1, T2) = T2, set_ordlist(T1), T2) = T2.
+:- pred set_ordlist.foldl(pred(T1, T2, T2), set_ordlist(T1), T2, T2).
+:- mode set_ordlist.foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode set_ordlist.foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode set_ordlist.foldl(pred(in, di, uo) is det, in, di, uo) is det.
+:- mode set_ordlist.foldl(pred(in, in, out) is semidet, in, in, out)
+    is semidet.
+:- mode set_ordlist.foldl(pred(in, mdi, muo) is semidet, in, mdi, muo)
+    is semidet.
+:- mode set_ordlist.foldl(pred(in, di, uo) is semidet, in, di, uo)
+    is semidet.
+
 :- pred set_ordlist.fold2(pred(T1, T2, T2, T3, T3), set_ordlist(T1),
     T2, T2, T3, T3).
 :- mode set_ordlist.fold2(pred(in, in, out, in, out) is det, in,
@@ -282,6 +294,21 @@
 :- mode set_ordlist.fold2(pred(in, in, out, di, uo) is semidet, in,
     in, out, di, uo) is semidet.
 
+:- pred set_ordlist.foldl2(pred(T1, T2, T2, T3, T3), set_ordlist(T1),
+    T2, T2, T3, T3).
+:- mode set_ordlist.foldl2(pred(in, in, out, in, out) is det, in,
+    in, out, in, out) is det.
+:- mode set_ordlist.foldl2(pred(in, in, out, mdi, muo) is det, in,
+    in, out, mdi, muo) is det.
+:- mode set_ordlist.foldl2(pred(in, in, out, di, uo) is det, in,
+    in, out, di, uo) is det.
+:- mode set_ordlist.foldl2(pred(in, in, out, in, out) is semidet, in,
+    in, out, in, out) is semidet.
+:- mode set_ordlist.foldl2(pred(in, in, out, mdi, muo) is semidet, in,
+    in, out, mdi, muo) is semidet.
+:- mode set_ordlist.foldl2(pred(in, in, out, di, uo) is semidet, in,
+    in, out, di, uo) is semidet.
+
 :- pred set_ordlist.fold3(pred(T1, T2, T2, T3, T3, T4, T4),
     set_ordlist(T1), T2, T2, T3, T3, T4, T4).
 :- mode set_ordlist.fold3(pred(in, in, out, in, out, in, out) is det, in,
@@ -297,6 +324,21 @@
 :- mode set_ordlist.fold3(pred(in, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, di, uo) is semidet.
 
+:- pred set_ordlist.foldl3(pred(T1, T2, T2, T3, T3, T4, T4),
+    set_ordlist(T1), T2, T2, T3, T3, T4, T4).
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out) is det.
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, mdi, muo) is det.
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, di, uo) is det.
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out) is semidet.
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, mdi, muo) is semidet.
+:- mode set_ordlist.foldl3(pred(in, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, di, uo) is semidet.
+
 :- pred set_ordlist.fold4(pred(T1, T2, T2, T3, T3, T4, T4, T5, T5),
     set_ordlist(T1), T2, T2, T3, T3, T4, T4, T5, T5).
 :- mode set_ordlist.fold4(
@@ -318,6 +360,27 @@
     pred(in, in, out, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_ordlist.foldl4(pred(T1, T2, T2, T3, T3, T4, T4, T5, T5),
+    set_ordlist(T1), T2, T2, T3, T3, T4, T4, T5, T5).
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out, in, out) is det.
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, in, out, di, uo) is det.
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out, in, out) is semidet.
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_ordlist.foldl4(
+    pred(in, in, out, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set_ordlist.fold5(
     pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6),
     set_ordlist(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6).
@@ -340,6 +403,28 @@
     pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_ordlist.foldl5(
+    pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6),
+    set_ordlist(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6).
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_ordlist.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set_ordlist.fold6(pred(T, A, A, B, B, C, C, D, D, E, E, F, F),
     set_ordlist(T), A, A, B, B, C, C, D, D, E, E, F, F).
 :- mode set_ordlist.fold6(
@@ -361,6 +446,27 @@
     pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_ordlist.foldl6(pred(T, A, A, B, B, C, C, D, D, E, E, F, F),
+    set_ordlist(T), A, A, B, B, C, C, D, D, E, E, F, F).
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_ordlist.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
+
     % all_true(Pred, Set) succeeds iff Pred(Element) succeeds
     % for all the elements of Set.
     %
@@ -724,25 +830,46 @@
 
 %-----------------------------------------------------------------------------%
 
-set_ordlist.fold(F, S, A) = B :-
+set_ordlist.fold(F, S, A) =
+    set_ordlist.foldl(F, S, A).
+
+set_ordlist.foldl(F, S, A) = B :-
     B = list.foldl(F, set_ordlist.to_sorted_list(S), A).
 
 set_ordlist.fold(P, S, !A) :-
+    set_ordlist.foldl(P, S, !A).
+
+set_ordlist.foldl(P, S, !A) :-
     list.foldl(P, set_ordlist.to_sorted_list(S), !A).
 
 set_ordlist.fold2(P, S, !A, !B) :-
+    set_ordlist.foldl2(P, S, !A, !B).
+
+set_ordlist.foldl2(P, S, !A, !B) :-
     list.foldl2(P, set_ordlist.to_sorted_list(S), !A, !B).
 
 set_ordlist.fold3(P, S, !A, !B, !C) :-
+    set_ordlist.foldl3(P, S, !A, !B, !C).
+
+set_ordlist.foldl3(P, S, !A, !B, !C) :-
     list.foldl3(P, set_ordlist.to_sorted_list(S), !A, !B, !C).
 
 set_ordlist.fold4(P, S, !A, !B, !C, !D) :-
+    set_ordlist.foldl4(P, S, !A, !B, !C, !D).
+
+set_ordlist.foldl4(P, S, !A, !B, !C, !D) :-
     list.foldl4(P, set_ordlist.to_sorted_list(S), !A, !B, !C, !D).
 
 set_ordlist.fold5(P, S, !A, !B, !C, !D, !E) :-
+    set_ordlist.foldl5(P, S, !A, !B, !C, !D, !E).
+
+set_ordlist.foldl5(P, S, !A, !B, !C, !D, !E) :-
     list.foldl5(P, set_ordlist.to_sorted_list(S), !A, !B, !C, !D, !E).
 
 set_ordlist.fold6(P, S, !A, !B, !C, !D, !E, !F) :-
+    set_ordlist.foldl6(P, S, !A, !B, !C, !D, !E, !F).
+
+set_ordlist.foldl6(P, S, !A, !B, !C, !D, !E, !F) :-
     list.foldl6(P, set_ordlist.to_sorted_list(S), !A, !B, !C, !D, !E, !F).
 
 %-----------------------------------------------------------------------------%
Index: library/set_tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_tree234.m,v
retrieving revision 1.22
diff -u -b -r1.22 set_tree234.m
--- library/set_tree234.m	24 Apr 2012 09:18:29 -0000	1.22
+++ library/set_tree234.m	26 Jun 2012 13:01:19 -0000
@@ -256,6 +256,18 @@
 :- mode set_tree234.fold(pred(in, di, uo) is semidet, in, di, uo)
     is semidet.
 
+:- func set_tree234.foldl(func(T1, T2) = T2, set_tree234(T1), T2) = T2.
+:- pred set_tree234.foldl(pred(T1, T2, T2), set_tree234(T1), T2, T2).
+:- mode set_tree234.foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode set_tree234.foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode set_tree234.foldl(pred(in, di, uo) is det, in, di, uo) is det.
+:- mode set_tree234.foldl(pred(in, in, out) is semidet, in, in, out)
+    is semidet.
+:- mode set_tree234.foldl(pred(in, mdi, muo) is semidet, in, mdi, muo)
+    is semidet.
+:- mode set_tree234.foldl(pred(in, di, uo) is semidet, in, di, uo)
+    is semidet.
+
 :- pred set_tree234.fold2(pred(T1, T2, T2, T3, T3), set_tree234(T1),
     T2, T2, T3, T3).
 :- mode set_tree234.fold2(pred(in, in, out, in, out) is det, in,
@@ -271,6 +283,21 @@
 :- mode set_tree234.fold2(pred(in, in, out, di, uo) is semidet, in,
     in, out, di, uo) is semidet.
 
+:- pred set_tree234.foldl2(pred(T1, T2, T2, T3, T3), set_tree234(T1),
+    T2, T2, T3, T3).
+:- mode set_tree234.foldl2(pred(in, in, out, in, out) is det, in,
+    in, out, in, out) is det.
+:- mode set_tree234.foldl2(pred(in, in, out, mdi, muo) is det, in,
+    in, out, mdi, muo) is det.
+:- mode set_tree234.foldl2(pred(in, in, out, di, uo) is det, in,
+    in, out, di, uo) is det.
+:- mode set_tree234.foldl2(pred(in, in, out, in, out) is semidet, in,
+    in, out, in, out) is semidet.
+:- mode set_tree234.foldl2(pred(in, in, out, mdi, muo) is semidet, in,
+    in, out, mdi, muo) is semidet.
+:- mode set_tree234.foldl2(pred(in, in, out, di, uo) is semidet, in,
+    in, out, di, uo) is semidet.
+
 :- pred set_tree234.fold3(
     pred(T1, T2, T2, T3, T3, T4, T4), set_tree234(T1),
     T2, T2, T3, T3, T4, T4).
@@ -287,6 +314,22 @@
 :- mode set_tree234.fold3(pred(in, in, out, in, out, di, uo) is semidet, in,
     in, out, in, out, di, uo) is semidet.
 
+:- pred set_tree234.foldl3(
+    pred(T1, T2, T2, T3, T3, T4, T4), set_tree234(T1),
+    T2, T2, T3, T3, T4, T4).
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, in, out) is det, in,
+    in, out, in, out, in, out) is det.
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, mdi, muo) is det, in,
+    in, out, in, out, mdi, muo) is det.
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, di, uo) is det, in,
+    in, out, in, out, di, uo) is det.
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, in, out) is semidet, in,
+    in, out, in, out, in, out) is semidet.
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, mdi, muo) is semidet, in,
+    in, out, in, out, mdi, muo) is semidet.
+:- mode set_tree234.foldl3(pred(in, in, out, in, out, di, uo) is semidet, in,
+    in, out, in, out, di, uo) is semidet.
+
 :- pred set_tree234.fold4(
     pred(T1, T2, T2, T3, T3, T4, T4, T5, T5), set_tree234(T1),
     T2, T2, T3, T3, T4, T4, T5, T5).
@@ -306,6 +349,25 @@
     pred(in, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_tree234.foldl4(
+    pred(T1, T2, T2, T3, T3, T4, T4, T5, T5), set_tree234(T1),
+    T2, T2, T3, T3, T4, T4, T5, T5).
+:- mode set_tree234.foldl4(pred(in, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out) is det.
+:- mode set_tree234.foldl4(pred(in, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_tree234.foldl4(pred(in, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, di, uo) is det.
+:- mode set_tree234.foldl4(
+    pred(in, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out) is semidet.
+:- mode set_tree234.foldl4(
+    pred(in, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_tree234.foldl4(
+    pred(in, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set_tree234.fold5(
     pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6),
     set_tree234(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6).
@@ -328,6 +390,28 @@
     pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_tree234.foldl5(
+    pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6),
+    set_tree234(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6).
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_tree234.foldl5(
+    pred(in, in, out, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, in, out, di, uo) is semidet.
+
 :- pred set_tree234.fold6(
     pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6, T7, T7),
     set_tree234(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6, T7, T7).
@@ -350,6 +434,28 @@
     pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
     in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
 
+:- pred set_tree234.foldl6(
+    pred(T1, T2, T2, T3, T3, T4, T4, T5, T5, T6, T6, T7, T7),
+    set_tree234(T1), T2, T2, T3, T3, T4, T4, T5, T5, T6, T6, T7, T7).
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is det,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is det.
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is det.
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is det,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is det.
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, in, out) is semidet.
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, mdi, muo) is semidet.
+:- mode set_tree234.foldl6(
+    pred(in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet,
+    in, in, out, in, out, in, out, in, out, in, out, di, uo) is semidet.
+
     % all_true(Pred, Set) succeeds iff Pred(Element) succeeds
     % for all the elements of Set.
     %
@@ -2402,147 +2508,168 @@
 
 %------------------------------------------------------------------------------%
 
-set_tree234.fold(_Pred, empty, !A).
-set_tree234.fold(Pred, two(E, T0, T1), !A) :-
-    set_tree234.fold(Pred, T0, !A),
+set_tree234.fold(Pred, Tree, !A) :-
+    set_tree234.foldl(Pred, Tree, !A).
+
+set_tree234.foldl(_Pred, empty, !A).
+set_tree234.foldl(Pred, two(E, T0, T1), !A) :-
+    set_tree234.foldl(Pred, T0, !A),
     Pred(E, !A),
-    set_tree234.fold(Pred, T1, !A).
-set_tree234.fold(Pred, three(E0, E1, T0, T1, T2), !A) :-
-    set_tree234.fold(Pred, T0, !A),
+    set_tree234.foldl(Pred, T1, !A).
+set_tree234.foldl(Pred, three(E0, E1, T0, T1, T2), !A) :-
+    set_tree234.foldl(Pred, T0, !A),
     Pred(E0, !A),
-    set_tree234.fold(Pred, T1, !A),
+    set_tree234.foldl(Pred, T1, !A),
     Pred(E1, !A),
-    set_tree234.fold(Pred, T2, !A).
-set_tree234.fold(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A) :-
-    set_tree234.fold(Pred, T0, !A),
+    set_tree234.foldl(Pred, T2, !A).
+set_tree234.foldl(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A) :-
+    set_tree234.foldl(Pred, T0, !A),
     Pred(E0, !A),
-    set_tree234.fold(Pred, T1, !A),
+    set_tree234.foldl(Pred, T1, !A),
     Pred(E1, !A),
-    set_tree234.fold(Pred, T2, !A),
+    set_tree234.foldl(Pred, T2, !A),
     Pred(E2, !A),
-    set_tree234.fold(Pred, T3, !A).
+    set_tree234.foldl(Pred, T3, !A).
 
-set_tree234.fold(_Func, empty, A) = A.
-set_tree234.fold(Func, two(E, T0, T1), !.A) = !:A :-
-    set_tree234.fold(Func, T0, !.A) = !:A,
+set_tree234.fold(Func, Tree, A0) =
+    set_tree234.foldl(Func, Tree, A0).
+
+set_tree234.foldl(_Func, empty, A) = A.
+set_tree234.foldl(Func, two(E, T0, T1), !.A) = !:A :-
+    set_tree234.foldl(Func, T0, !.A) = !:A,
     !:A = Func(E, !.A),
-    set_tree234.fold(Func, T1, !.A) = !:A.
-set_tree234.fold(Func, three(E0, E1, T0, T1, T2), !.A) = !:A :-
-    set_tree234.fold(Func, T0, !.A) = !:A,
+    set_tree234.foldl(Func, T1, !.A) = !:A.
+set_tree234.foldl(Func, three(E0, E1, T0, T1, T2), !.A) = !:A :-
+    set_tree234.foldl(Func, T0, !.A) = !:A,
     !:A = Func(E0, !.A),
-    set_tree234.fold(Func, T1, !.A) = !:A,
+    set_tree234.foldl(Func, T1, !.A) = !:A,
     !:A = Func(E1, !.A),
-    set_tree234.fold(Func, T2, !.A) = !:A.
-set_tree234.fold(Func, four(E0, E1, E2, T0, T1, T2, T3), !.A) = !:A :-
-    set_tree234.fold(Func, T0, !.A) = !:A,
+    set_tree234.foldl(Func, T2, !.A) = !:A.
+set_tree234.foldl(Func, four(E0, E1, E2, T0, T1, T2, T3), !.A) = !:A :-
+    set_tree234.foldl(Func, T0, !.A) = !:A,
     !:A = Func(E0, !.A),
-    set_tree234.fold(Func, T1, !.A) = !:A,
+    set_tree234.foldl(Func, T1, !.A) = !:A,
     !:A = Func(E1, !.A),
-    set_tree234.fold(Func, T2, !.A) = !:A,
+    set_tree234.foldl(Func, T2, !.A) = !:A,
     !:A = Func(E2, !.A),
-    set_tree234.fold(Func, T3, !.A) = !:A.
+    set_tree234.foldl(Func, T3, !.A) = !:A.
+
+set_tree234.fold2(Pred, Tree, !A, !B) :-
+    set_tree234.foldl2(Pred, Tree, !A, !B).
 
-set_tree234.fold2(_Pred, empty, !A, !B).
-set_tree234.fold2(Pred, two(E, T0, T1), !A, !B) :-
-    set_tree234.fold2(Pred, T0, !A, !B),
+set_tree234.foldl2(_Pred, empty, !A, !B).
+set_tree234.foldl2(Pred, two(E, T0, T1), !A, !B) :-
+    set_tree234.foldl2(Pred, T0, !A, !B),
     Pred(E, !A, !B),
-    set_tree234.fold2(Pred, T1, !A, !B).
-set_tree234.fold2(Pred, three(E0, E1, T0, T1, T2), !A, !B) :-
-    set_tree234.fold2(Pred, T0, !A, !B),
+    set_tree234.foldl2(Pred, T1, !A, !B).
+set_tree234.foldl2(Pred, three(E0, E1, T0, T1, T2), !A, !B) :-
+    set_tree234.foldl2(Pred, T0, !A, !B),
     Pred(E0, !A, !B),
-    set_tree234.fold2(Pred, T1, !A, !B),
+    set_tree234.foldl2(Pred, T1, !A, !B),
     Pred(E1, !A, !B),
-    set_tree234.fold2(Pred, T2, !A, !B).
-set_tree234.fold2(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B) :-
-    set_tree234.fold2(Pred, T0, !A, !B),
+    set_tree234.foldl2(Pred, T2, !A, !B).
+set_tree234.foldl2(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B) :-
+    set_tree234.foldl2(Pred, T0, !A, !B),
     Pred(E0, !A, !B),
-    set_tree234.fold2(Pred, T1, !A, !B),
+    set_tree234.foldl2(Pred, T1, !A, !B),
     Pred(E1, !A, !B),
-    set_tree234.fold2(Pred, T2, !A, !B),
+    set_tree234.foldl2(Pred, T2, !A, !B),
     Pred(E2, !A, !B),
-    set_tree234.fold2(Pred, T3, !A, !B).
+    set_tree234.foldl2(Pred, T3, !A, !B).
 
-set_tree234.fold3(_Pred, empty, !A, !B, !C).
-set_tree234.fold3(Pred, two(E, T0, T1), !A, !B, !C) :-
-    set_tree234.fold3(Pred, T0, !A, !B, !C),
+set_tree234.fold3(Pred, Tree, !A, !B, !C) :-
+    set_tree234.foldl3(Pred, Tree, !A, !B, !C).
+
+set_tree234.foldl3(_Pred, empty, !A, !B, !C).
+set_tree234.foldl3(Pred, two(E, T0, T1), !A, !B, !C) :-
+    set_tree234.foldl3(Pred, T0, !A, !B, !C),
     Pred(E, !A, !B, !C),
-    set_tree234.fold3(Pred, T1, !A, !B, !C).
-set_tree234.fold3(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C) :-
-    set_tree234.fold3(Pred, T0, !A, !B, !C),
+    set_tree234.foldl3(Pred, T1, !A, !B, !C).
+set_tree234.foldl3(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C) :-
+    set_tree234.foldl3(Pred, T0, !A, !B, !C),
     Pred(E0, !A, !B, !C),
-    set_tree234.fold3(Pred, T1, !A, !B, !C),
+    set_tree234.foldl3(Pred, T1, !A, !B, !C),
     Pred(E1, !A, !B, !C),
-    set_tree234.fold3(Pred, T2, !A, !B, !C).
-set_tree234.fold3(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C) :-
-    set_tree234.fold3(Pred, T0, !A, !B, !C),
+    set_tree234.foldl3(Pred, T2, !A, !B, !C).
+set_tree234.foldl3(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C) :-
+    set_tree234.foldl3(Pred, T0, !A, !B, !C),
     Pred(E0, !A, !B, !C),
-    set_tree234.fold3(Pred, T1, !A, !B, !C),
+    set_tree234.foldl3(Pred, T1, !A, !B, !C),
     Pred(E1, !A, !B, !C),
-    set_tree234.fold3(Pred, T2, !A, !B, !C),
+    set_tree234.foldl3(Pred, T2, !A, !B, !C),
     Pred(E2, !A, !B, !C),
-    set_tree234.fold3(Pred, T3, !A, !B, !C).
+    set_tree234.foldl3(Pred, T3, !A, !B, !C).
+
+set_tree234.fold4(Pred, Tree, !A, !B, !C, !D) :-
+    set_tree234.foldl4(Pred, Tree, !A, !B, !C, !D).
 
-set_tree234.fold4(_Pred, empty, !A, !B, !C, !D).
-set_tree234.fold4(Pred, two(E, T0, T1), !A, !B, !C, !D) :-
-    set_tree234.fold4(Pred, T0, !A, !B, !C, !D),
+set_tree234.foldl4(_Pred, empty, !A, !B, !C, !D).
+set_tree234.foldl4(Pred, two(E, T0, T1), !A, !B, !C, !D) :-
+    set_tree234.foldl4(Pred, T0, !A, !B, !C, !D),
     Pred(E, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T1, !A, !B, !C, !D).
-set_tree234.fold4(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D) :-
-    set_tree234.fold4(Pred, T0, !A, !B, !C, !D),
+    set_tree234.foldl4(Pred, T1, !A, !B, !C, !D).
+set_tree234.foldl4(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D) :-
+    set_tree234.foldl4(Pred, T0, !A, !B, !C, !D),
     Pred(E0, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T1, !A, !B, !C, !D),
+    set_tree234.foldl4(Pred, T1, !A, !B, !C, !D),
     Pred(E1, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T2, !A, !B, !C, !D).
-set_tree234.fold4(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D) :-
-    set_tree234.fold4(Pred, T0, !A, !B, !C, !D),
+    set_tree234.foldl4(Pred, T2, !A, !B, !C, !D).
+set_tree234.foldl4(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D) :-
+    set_tree234.foldl4(Pred, T0, !A, !B, !C, !D),
     Pred(E0, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T1, !A, !B, !C, !D),
+    set_tree234.foldl4(Pred, T1, !A, !B, !C, !D),
     Pred(E1, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T2, !A, !B, !C, !D),
+    set_tree234.foldl4(Pred, T2, !A, !B, !C, !D),
     Pred(E2, !A, !B, !C, !D),
-    set_tree234.fold4(Pred, T3, !A, !B, !C, !D).
+    set_tree234.foldl4(Pred, T3, !A, !B, !C, !D).
 
-set_tree234.fold5(_Pred, empty, !A, !B, !C, !D, !E).
-set_tree234.fold5(Pred, two(E, T0, T1), !A, !B, !C, !D, !E) :-
-    set_tree234.fold5(Pred, T0, !A, !B, !C, !D, !E),
+set_tree234.fold5(Pred, Tree, !A, !B, !C, !D, !E) :-
+    set_tree234.foldl5(Pred, Tree, !A, !B, !C, !D, !E).
+
+set_tree234.foldl5(_Pred, empty, !A, !B, !C, !D, !E).
+set_tree234.foldl5(Pred, two(E, T0, T1), !A, !B, !C, !D, !E) :-
+    set_tree234.foldl5(Pred, T0, !A, !B, !C, !D, !E),
     Pred(E, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T1, !A, !B, !C, !D, !E).
-set_tree234.fold5(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D, !E) :-
-    set_tree234.fold5(Pred, T0, !A, !B, !C, !D, !E),
+    set_tree234.foldl5(Pred, T1, !A, !B, !C, !D, !E).
+set_tree234.foldl5(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D, !E) :-
+    set_tree234.foldl5(Pred, T0, !A, !B, !C, !D, !E),
     Pred(E0, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T1, !A, !B, !C, !D, !E),
+    set_tree234.foldl5(Pred, T1, !A, !B, !C, !D, !E),
     Pred(E1, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T2, !A, !B, !C, !D, !E).
-set_tree234.fold5(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D,
+    set_tree234.foldl5(Pred, T2, !A, !B, !C, !D, !E).
+set_tree234.foldl5(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D,
         !E) :-
-    set_tree234.fold5(Pred, T0, !A, !B, !C, !D, !E),
+    set_tree234.foldl5(Pred, T0, !A, !B, !C, !D, !E),
     Pred(E0, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T1, !A, !B, !C, !D, !E),
+    set_tree234.foldl5(Pred, T1, !A, !B, !C, !D, !E),
     Pred(E1, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T2, !A, !B, !C, !D, !E),
+    set_tree234.foldl5(Pred, T2, !A, !B, !C, !D, !E),
     Pred(E2, !A, !B, !C, !D, !E),
-    set_tree234.fold5(Pred, T3, !A, !B, !C, !D, !E).
+    set_tree234.foldl5(Pred, T3, !A, !B, !C, !D, !E).
+
+set_tree234.fold6(Pred, Tree, !A, !B, !C, !D, !E, !F) :-
+    set_tree234.foldl6(Pred, Tree, !A, !B, !C, !D, !E, !F).
 
-set_tree234.fold6(_Pred, empty, !A, !B, !C, !D, !E, !F).
-set_tree234.fold6(Pred, two(E, T0, T1), !A, !B, !C, !D, !E, !F) :-
-    set_tree234.fold6(Pred, T0, !A, !B, !C, !D, !E, !F),
+set_tree234.foldl6(_Pred, empty, !A, !B, !C, !D, !E, !F).
+set_tree234.foldl6(Pred, two(E, T0, T1), !A, !B, !C, !D, !E, !F) :-
+    set_tree234.foldl6(Pred, T0, !A, !B, !C, !D, !E, !F),
     Pred(E, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T1, !A, !B, !C, !D, !E, !F).
-set_tree234.fold6(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D, !E, !F) :-
-    set_tree234.fold6(Pred, T0, !A, !B, !C, !D, !E, !F),
+    set_tree234.foldl6(Pred, T1, !A, !B, !C, !D, !E, !F).
+set_tree234.foldl6(Pred, three(E0, E1, T0, T1, T2), !A, !B, !C, !D, !E, !F) :-
+    set_tree234.foldl6(Pred, T0, !A, !B, !C, !D, !E, !F),
     Pred(E0, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T1, !A, !B, !C, !D, !E, !F),
+    set_tree234.foldl6(Pred, T1, !A, !B, !C, !D, !E, !F),
     Pred(E1, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T2, !A, !B, !C, !D, !E, !F).
-set_tree234.fold6(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D,
+    set_tree234.foldl6(Pred, T2, !A, !B, !C, !D, !E, !F).
+set_tree234.foldl6(Pred, four(E0, E1, E2, T0, T1, T2, T3), !A, !B, !C, !D,
         !E, !F) :-
-    set_tree234.fold6(Pred, T0, !A, !B, !C, !D, !E, !F),
+    set_tree234.foldl6(Pred, T0, !A, !B, !C, !D, !E, !F),
     Pred(E0, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T1, !A, !B, !C, !D, !E, !F),
+    set_tree234.foldl6(Pred, T1, !A, !B, !C, !D, !E, !F),
     Pred(E1, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T2, !A, !B, !C, !D, !E, !F),
+    set_tree234.foldl6(Pred, T2, !A, !B, !C, !D, !E, !F),
     Pred(E2, !A, !B, !C, !D, !E, !F),
-    set_tree234.fold6(Pred, T3, !A, !B, !C, !D, !E, !F).
+    set_tree234.foldl6(Pred, T3, !A, !B, !C, !D, !E, !F).
 
 %------------------------------------------------------------------------------%
 
cvs diff: Diffing m4
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/appengine
cvs diff: Diffing samples/appengine/war
cvs diff: Diffing samples/appengine/war/WEB-INF
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/lazy_list
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/feedback
cvs diff: Diffing tests/feedback/mandelbrot
cvs diff: Diffing tests/feedback/mmc
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list