[m-rev.] trivial diff: style fixes for map/tree234 modules

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Feb 1 17:08:19 AEDT 2007


Estimated hours taken: 0.2
Branches: main

Make a few minor cleanups to the map and tree234 modules.

library/tree234.m:
 	Comment out a bunch of unique modes that are unused.

 	Minor style fixes.

library/map.m:
 	Use state variables in a couple of spots.

Julien.

Index: map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.108
diff -u -r1.108 map.m
--- map.m	23 Oct 2006 00:32:58 -0000	1.108
+++ map.m	1 Feb 2007 06:04:26 -0000
@@ -862,19 +862,16 @@
  :- mode map.intersect_2(in, in, pred(in, in, out) is det, in, out)
      is det.

-map.intersect_2(AssocList1, AssocList2, CommonPred, Common0, Common) :-
+map.intersect_2(AssocList1, AssocList2, CommonPred, !Common) :-
      (
          AssocList1 = [],
-        AssocList2 = [],
-        Common = Common0
+        AssocList2 = []
      ;
          AssocList1 = [_ | _],
-        AssocList2 = [],
-        Common = Common0
+        AssocList2 = []
      ;
          AssocList1 = [],
-        AssocList2 = [_ | _],
-        Common = Common0
+        AssocList2 = [_ | _]
      ;
          AssocList1 = [Key1 - Value1 | AssocTail1],
          AssocList2 = [Key2 - Value2 | AssocTail2],
@@ -882,17 +879,14 @@
          (
              R = (=),
              CommonPred(Value1, Value2, Value),
-            map.det_insert(Common0, Key1, Value, Common1),
-            map.intersect_2(AssocTail1, AssocTail2, CommonPred,
-                Common1, Common)
+            map.det_insert(!.Common, Key1, Value, !:Common),
+            map.intersect_2(AssocTail1, AssocTail2, CommonPred, !Common)
          ;
              R = (<),
-            map.intersect_2(AssocTail1, AssocList2, CommonPred,
-                Common0, Common)
+            map.intersect_2(AssocTail1, AssocList2, CommonPred, !Common)
          ;
              R = (>),
-            map.intersect_2(AssocList1, AssocTail2, CommonPred,
-                Common0, Common)
+            map.intersect_2(AssocList1, AssocTail2, CommonPred, !Common)
          )
      ).

@@ -966,19 +960,18 @@
  :- mode map.union_2(in, in, pred(in, in, out) is det, in, out)
      is det.

-map.union_2(AssocList1, AssocList2, CommonPred, Common0, Common) :-
+map.union_2(AssocList1, AssocList2, CommonPred, !Common) :-
      (
          AssocList1 = [],
-        AssocList2 = [],
-        Common = Common0
+        AssocList2 = []
      ;
          AssocList1 = [_ | _],
          AssocList2 = [],
-        map.det_insert_from_assoc_list(Common0, AssocList1, Common)
+        map.det_insert_from_assoc_list(!.Common, AssocList1, !:Common)
      ;
          AssocList1 = [],
          AssocList2 = [_ | _],
-        map.det_insert_from_assoc_list(Common0, AssocList2, Common)
+        map.det_insert_from_assoc_list(!.Common, AssocList2, !:Common)
      ;
          AssocList1 = [Key1 - Value1 | AssocTail1],
          AssocList2 = [Key2 - Value2 | AssocTail2],
@@ -986,16 +979,16 @@
          (
              R = (=),
              CommonPred(Value1, Value2, Value),
-            map.det_insert(Common0, Key1, Value, Common1),
-            map.union_2(AssocTail1, AssocTail2, CommonPred, Common1, Common)
+            map.det_insert(!.Common, Key1, Value, !:Common),
+            map.union_2(AssocTail1, AssocTail2, CommonPred, !Common)
          ;
              R = (<),
-            map.det_insert(Common0, Key1, Value1, Common1),
-            map.union_2(AssocTail1, AssocList2, CommonPred, Common1, Common)
+            map.det_insert(!.Common, Key1, Value1, !:Common),
+            map.union_2(AssocTail1, AssocList2, CommonPred, !Common)
          ;
              R = (>),
-            map.det_insert(Common0, Key2, Value2, Common1),
-            map.union_2(AssocList1, AssocTail2, CommonPred, Common1, Common)
+            map.det_insert(!.Common, Key2, Value2, !:Common),
+            map.union_2(AssocList1, AssocTail2, CommonPred, !Common)
          )
      ).

@@ -1102,27 +1095,27 @@
      map.optimize(M1, M2).

  map.foldl(F, M, A) = B :-
-    P = ( pred(W::in, X::in, Y::in, Z::out) is det :- Z = F(W, X, Y) ),
+    P = (pred(W::in, X::in, Y::in, Z::out) is det :- Z = F(W, X, Y) ),
      map.foldl(P, M, A, B).

  map.map_values(F, M1) = M2 :-
-    P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+    P = (pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
      map.map_values(P, M1, M2).

  map.intersect(F, M1, M2) = M3 :-
-    P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+    P = (pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
      map.intersect(P, M1, M2, M3).

  map.det_intersect(PF, M1, M2) = M3 :-
-    P = ( pred(X::in, Y::in, Z::out) is semidet :- Z = PF(X, Y) ),
+    P = (pred(X::in, Y::in, Z::out) is semidet :- Z = PF(X, Y) ),
      map.det_intersect(P, M1, M2, M3).

  map.union(F, M1, M2) = M3 :-
-    P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+    P = (pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
      map.union(P, M1, M2, M3).

  map.det_union(F, M1, M2) = M3 :-
-    P = ( pred(X::in, Y::in, Z::out) is semidet :- Z = F(X, Y) ),
+    P = (pred(X::in, Y::in, Z::out) is semidet :- Z = F(X, Y) ),
      map.det_union(P, M1, M2, M3).

  map.reverse_map(Map) = RevMap :-
Index: tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.56
diff -u -r1.56 tree234.m
--- tree234.m	23 Oct 2006 00:33:01 -0000	1.56
+++ tree234.m	1 Feb 2007 06:04:26 -0000
@@ -903,15 +903,13 @@

  %------------------------------------------------------------------------------%

-% tree234.insert is implemented using the simple top-down
-% approach described in eg Sedgwick which splits 4 nodes into
-% two 2 nodes on the downward traversal of the tree as we
-% search for the right place to insert the new key-value pair.
-% We know we have the right place if the subtrees of the node
-% are empty (in which case we expand the node - which will always
-% work because we already split 4 nodes into 2 nodes), or if the
-% tree itself is empty.
-% This algorithm is O(lgN).
+% tree234.insert is implemented using the simple top-down approach described
+% in Sedgwick that splits 4-nodes into two 2-nodes on the downward traversal
+% of the tree as we search for the right place to insert the new key-value
+% pair.  We know we have the right place if the subtrees of the node are
+% empty (in which case we expand the node - which will always work because
+% we have already split 4-nodes into 2-nodes), or if the tree itself is
+% empty.  This algorithm is O(lgN).

  tree234.insert(Tin, K, V, Tout) :-
      (
@@ -949,7 +947,7 @@
  tree234.insert2(two(K0, V0, T0, T1), K, V, Tout) :-
      (
          T0 = empty
-        % T1 = empty implied by T0 = empty
+        % T1 = empty implied by T0 = empty.
      ->
          compare(Result, K, K0),
          (
@@ -1040,8 +1038,8 @@
  tree234.insert3(three(K0, V0, K1, V1, T0, T1, T2), K, V, Tout) :-
      (
          T0 = empty
-        % T1 = empty implied by T0 = empty
-        % T2 = empty implied by T0 = empty
+        % T1 = empty implied by T0 = empty.
+        % T2 = empty implied by T0 = empty.
      ->
          compare(Result0, K, K0),
          (
@@ -1224,7 +1222,7 @@
  tree234.set2(two(K0, V0, T0, T1), K, V, Tout) :-
      (
          T0 = empty
-        % T1 = empty implied by T0 = empty
+        % T1 = empty implied by T0 = empty.
      ->
          compare(Result, K, K0),
          (
@@ -1464,7 +1462,7 @@
      % reduced by one. The last argument says whether this has occurred.

  :- pred tree234.delete_2(tree234(K, V), K, tree234(K, V), bool).
-:- mode tree234.delete_2(di, in, uo, out) is det.
+%:- mode tree234.delete_2(di, in, uo, out) is det.
  :- mode tree234.delete_2(in, in, out, out) is det.

  tree234.delete_2(Tin, K, Tout, RH) :-
@@ -1488,12 +1486,10 @@
              )
          ;
              Result0 = (=),
-            ( tree234.remove_smallest_2(T1, ST1K, ST1V, NewT1, RHT1)
-            ->
+            ( tree234.remove_smallest_2(T1, ST1K, ST1V, NewT1, RHT1) ->
                  (
                      RHT1 = yes,
-                    fix_2node_t1(ST1K, ST1V, T0, NewT1,
-                        Tout, RH)
+                    fix_2node_t1(ST1K, ST1V, T0, NewT1, Tout, RH)
                  ;
                      RHT1 = no,
                      Tout = two(ST1K, ST1V, T0, NewT1),
@@ -1566,15 +1562,15 @@
                  ( tree234.remove_smallest_2(T2, ST2K, ST2V, NewT2, RHT2) ->
                      (
                          RHT2 = yes,
-                        fix_3node_t2(K0, V0, ST2K, ST2V,
-                            T0, T1, NewT2, Tout, RH)
+                        fix_3node_t2(K0, V0, ST2K, ST2V, T0, T1, NewT2, Tout,
+                            RH)
                      ;
                          RHT2 = no,
                          Tout = three(K0, V0, ST2K, ST2V, T0, T1, NewT2),
                          RH = no
                      )
                  ;
-                    % T2 must be empty
+                    % T2 must be empty.
                      Tout = two(K0, V0, T0, T1),
                      RH = no
                  )
@@ -1623,7 +1619,7 @@
                          RH = no
                      )
                  ;
-                    % T1 must be empty
+                    % T1 must be empty.
                      Tout = three(K1, V1, K2, V2, T0, T2, T3),
                      RH = no
                  )
@@ -1715,7 +1711,7 @@
      tree234.remove_2(Tin, K, V, Tout, _).

  :- pred tree234.remove_2(tree234(K, V), K, V, tree234(K, V), bool).
-:- mode tree234.remove_2(di, in, uo, uo, out) is semidet.
+%:- mode tree234.remove_2(di, in, uo, uo, out) is semidet.
  :- mode tree234.remove_2(in, in, out, out, out) is semidet.

  tree234.remove_2(Tin, K, V, Tout, RH) :-
@@ -1748,7 +1744,7 @@
                      RH = no
                  )
              ;
-                % T1 must be empty
+                % T1 must be empty.
                  Tout = T0,
                  RH = yes
              ),
@@ -1791,7 +1787,7 @@
                      RH = no
                  )
              ;
-                % T1 must be empty
+                % T1 must be empty.
                  Tout = two(K1, V1, T0, T2),
                  RH = no
              ),
@@ -1823,7 +1819,7 @@
                          RH = no
                      )
                  ;
-                    % T2 must be empty
+                    % T2 must be empty.
                      Tout = two(K0, V0, T0, T1),
                      RH = no
                  ),
@@ -1873,7 +1869,7 @@
                          RH = no
                      )
                  ;
-                    % T1 must be empty
+                    % T1 must be empty.
                      Tout = three(K1, V1, K2, V2, T0, T2, T3),
                      RH = no
                  ),
@@ -1904,7 +1900,7 @@
                      RH = no
                  )
              ;
-                % T2 must be empty
+                % T2 must be empty.
                  Tout = three(K0, V0, K2, V2, T0, T1, T3),
                  RH = no
              ),
@@ -1938,7 +1934,7 @@
                          RH = no
                      )
                  ;
-                    % T3 must be empty
+                    % T3 must be empty.
                      Tout = three(K0, V0, K1, V1, T0, T1, T2),
                      RH = no
                  ),
@@ -1968,7 +1964,7 @@
      tree234.remove_smallest_2(Tin, K, V, Tout, _).

  :- pred tree234.remove_smallest_2(tree234(K, V), K, V, tree234(K, V), bool).
-:- mode tree234.remove_smallest_2(di, uo, uo, uo, out) is semidet.
+%:- mode tree234.remove_smallest_2(di, uo, uo, uo, out) is semidet.
  :- mode tree234.remove_smallest_2(in, out, out, out, out) is semidet.

  tree234.remove_smallest_2(Tin, K, V, Tout, RH) :-
@@ -2036,7 +2032,7 @@

      % The input to the following group of predicates are the components
      % of a two-, three- or four-node in which the height of the indicated
-    % subtree is one less that it should be. If it is possible to increase
+    % subtree is one less than it should be. If it is possible to increase
      % the height of that subtree by moving into it elements from its
      % neighboring subtrees, do so, and return the resulting tree with RH
      % set to no. Otherwise, return a balanced tree whose height is reduced
@@ -2048,22 +2044,22 @@

  fix_2node_t0(K0, V0, T0, T1, Tout, RH) :-
      (
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = four(K10, V10, K11, V11, K12, V12, T10, T11, T12, T13),
          NewT1 = three(K11, V11, K12, V12, T11, T12, T13),
          Node = two(K0, V0, T0, T10),
          Tout = two(K10, V10, Node, NewT1),
          RH = no
      ;
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = three(K10, V10, K11, V11, T10, T11, T12),
          NewT1 = two(K11, V11, T11, T12),
          Node = two(K0, V0, T0, T10),
          Tout = two(K10, V10, Node, NewT1),
          RH = no
      ;
-        % move T0 one level down and combine it with the subtrees of T1
-        % this reduces the depth of the tree
+        % Move T0 one level down and combine it with the subtrees of T1
+        % this reduces the depth of the tree.
          T1 = two(K10, V10, T10, T11),
          Tout = three(K0, V0, K10, V10, T0, T10, T11),
          RH = yes
@@ -2080,22 +2076,22 @@

  fix_2node_t1(K0, V0, T0, T1, Tout, RH) :-
      (
-        % steal T0's leftmost subtree and combine it with T1
+        % Steal T0's leftmost subtree and combine it with T1.
          T0 = four(K00, V00, K01, V01, K02, V02, T00, T01, T02, T03),
          NewT0 = three(K00, V00, K01, V01, T00, T01, T02),
          Node = two(K0, V0, T03, T1),
          Tout = two(K02, V02, NewT0, Node),
          RH = no
      ;
-        % steal T0's leftmost subtree and combine it with T1
+        % Steal T0's leftmost subtree and combine it with T1.
          T0 = three(K00, V00, K01, V01, T00, T01, T02),
          NewT0 = two(K00, V00, T00, T01),
          Node = two(K0, V0, T02, T1),
          Tout = two(K01, V01, NewT0, Node),
          RH = no
      ;
-        % move T1 one level down and combine it with the subtrees of T0
-        % this reduces the depth of the tree
+        % Move T1 one level down and combine it with the subtrees of T0
+        % this reduces the depth of the tree.
          T0 = two(K00, V00, T00, T01),
          Tout = three(K00, V00, K0, V0, T00, T01, T1),
          RH = yes
@@ -2113,21 +2109,21 @@

  fix_3node_t0(K0, V0, K1, V1, T0, T1, T2, Tout, RH) :-
      (
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = four(K10, V10, K11, V11, K12, V12, T10, T11, T12, T13),
          NewT1 = three(K11, V11, K12, V12, T11, T12, T13),
          Node = two(K0, V0, T0, T10),
          Tout = three(K10, V10, K1, V1, Node, NewT1, T2),
          RH = no
      ;
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = three(K10, V10, K11, V11, T10, T11, T12),
          NewT1 = two(K11, V11, T11, T12),
          Node = two(K0, V0, T0, T10),
          Tout = three(K10, V10, K1, V1, Node, NewT1, T2),
          RH = no
      ;
-        % move T0 one level down to become the leftmost subtree of T1
+        % Move T0 one level down to become the leftmost subtree of T1.
          T1 = two(K10, V10, T10, T11),
          NewT1 = three(K0, V0, K10, V10, T0, T10, T11),
          Tout = two(K1, V1, NewT1, T2),
@@ -2142,26 +2138,26 @@

  :- pred fix_3node_t1(K, V, K, V, tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_3node_t1(di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_3node_t1(di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_3node_t1(in, in, in, in, in, in, in, out, out) is det.

  fix_3node_t1(K0, V0, K1, V1, T0, T1, T2, Tout, RH) :-
      (
-        % steal T0's rightmost subtree and combine it with T1
+        % Steal T0's rightmost subtree and combine it with T1.
          T0 = four(K00, V00, K01, V01, K02, V02, T00, T01, T02, T03),
          NewT0 = three(K00, V00, K01, V01, T00, T01, T02),
          Node = two(K0, V0, T03, T1),
          Tout = three(K02, V02, K1, V1, NewT0, Node, T2),
          RH = no
      ;
-        % steal T0's rightmost subtree and combine it with T1
+        % Steal T0's rightmost subtree and combine it with T1.
          T0 = three(K00, V00, K01, V01, T00, T01, T02),
          NewT0 = two(K00, V00, T00, T01),
          Node = two(K0, V0, T02, T1),
          Tout = three(K01, V01, K1, V1, NewT0, Node, T2),
          RH = no
      ;
-        % move T1 one level down to become the rightmost subtree of T0
+        % Move T1 one level down to become the rightmost subtree of T0.
          T0 = two(K00, V00, T00, T01),
          NewT0 = three(K00, V00, K0, V0, T00, T01, T1),
          Tout = two(K1, V1, NewT0, T2),
@@ -2176,26 +2172,26 @@

  :- pred fix_3node_t2(K, V, K, V, tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_3node_t2(di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_3node_t2(di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_3node_t2(in, in, in, in, in, in, in, out, out) is det.

  fix_3node_t2(K0, V0, K1, V1, T0, T1, T2, Tout, RH) :-
      (
-        % steal T1's rightmost subtree and combine it with T2
+        % Steal T1's rightmost subtree and combine it with T2.
          T1 = four(K10, V10, K11, V11, K12, V12, T10, T11, T12, T13),
          NewT1 = three(K10, V10, K11, V11, T10, T11, T12),
          Node = two(K1, V1, T13, T2),
          Tout = three(K0, V0, K12, V12, T0, NewT1, Node),
          RH = no
      ;
-        % steal T1's rightmost subtree and combine it with T2
+        % Steal T1's rightmost subtree and combine it with T2.
          T1 = three(K10, V10, K11, V11, T10, T11, T12),
          NewT1 = two(K10, V10, T10, T11),
          Node = two(K1, V1, T12, T2),
          Tout = three(K0, V0, K11, V11, T0, NewT1, Node),
          RH = no
      ;
-        % move T2 one level down to become the rightmost subtree of T1
+        % Move T2 one level down to become the rightmost subtree of T1.
          T1 = two(K10, V10, T10, T11),
          NewT1 = three(K10, V10, K1, V1, T10, T11, T2),
          Tout = two(K0, V0, T0, NewT1),
@@ -2211,26 +2207,26 @@
  :- pred fix_4node_t0(K, V, K, V, K, V,
      tree234(K, V), tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_4node_t0(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_4node_t0(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_4node_t0(in, in, in, in, in, in, in, in, in, in, out, out) is det.

  fix_4node_t0(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3, Tout, RH) :-
      (
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = four(K10, V10, K11, V11, K12, V12, T10, T11, T12, T13),
          NewT1 = three(K11, V11, K12, V12, T11, T12, T13),
          Node = two(K0, V0, T0, T10),
          Tout = four(K10, V10, K1, V1, K2, V2, Node, NewT1, T2, T3),
          RH = no
      ;
-        % steal T1's leftmost subtree and combine it with T0
+        % Steal T1's leftmost subtree and combine it with T0.
          T1 = three(K10, V10, K11, V11, T10, T11, T12),
          NewT1 = two(K11, V11, T11, T12),
          Node = two(K0, V0, T0, T10),
          Tout = four(K10, V10, K1, V1, K2, V2, Node, NewT1, T2, T3),
          RH = no
      ;
-        % move T0 one level down to become the leftmost subtree of T1
+        % Move T0 one level down to become the leftmost subtree of T1.
          T1 = two(K10, V10, T10, T11),
          NewT1 = three(K0, V0, K10, V10, T0, T10, T11),
          Tout = three(K1, V1, K2, V2, NewT1, T2, T3),
@@ -2246,26 +2242,26 @@
  :- pred fix_4node_t1(K, V, K, V, K, V,
      tree234(K, V), tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_4node_t1(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_4node_t1(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_4node_t1(in, in, in, in, in, in, in, in, in, in, out, out) is det.

  fix_4node_t1(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3, Tout, RH) :-
      (
-        % steal T2's leftmost subtree and combine it with T1
+        % Steal T2's leftmost subtree and combine it with T1.
          T2 = four(K20, V20, K21, V21, K22, V22, T20, T21, T22, T23),
          NewT2 = three(K21, V21, K22, V22, T21, T22, T23),
          Node = two(K1, V1, T1, T20),
          Tout = four(K0, V0, K20, V20, K2, V2, T0, Node, NewT2, T3),
          RH = no
      ;
-        % steal T2's leftmost subtree and combine it with T1
+        % Steal T2's leftmost subtree and combine it with T1.
          T2 = three(K20, V20, K21, V21, T20, T21, T22),
          NewT2 = two(K21, V21, T21, T22),
          Node = two(K1, V1, T1, T20),
          Tout = four(K0, V0, K20, V20, K2, V2, T0, Node, NewT2, T3),
          RH = no
      ;
-        % move T1 one level down to become the leftmost subtree of T2
+        % Move T1 one level down to become the leftmost subtree of T2.
          T2 = two(K20, V20, T20, T21),
          NewT2 = three(K1, V1, K20, V20, T1, T20, T21),
          Tout = three(K0, V0, K2, V2, T0, NewT2, T3),
@@ -2281,26 +2277,26 @@
  :- pred fix_4node_t2(K, V, K, V, K, V,
      tree234(K, V), tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_4node_t2(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_4node_t2(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_4node_t2(in, in, in, in, in, in, in, in, in, in, out, out) is det.

  fix_4node_t2(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3, Tout, RH) :-
      (
-        % steal T3's leftmost subtree and combine it with T2
+        % Steal T3's leftmost subtree and combine it with T2.
          T3 = four(K30, V30, K31, V31, K32, V32, T30, T31, T32, T33),
          NewT3 = three(K31, V31, K32, V32, T31, T32, T33),
          Node = two(K2, V2, T2, T30),
          Tout = four(K0, V0, K1, V1, K30, V30, T0, T1, Node, NewT3),
          RH = no
      ;
-        % steal T3's leftmost subtree and combine it with T2
+        % Steal T3's leftmost subtree and combine it with T2.
          T3 = three(K30, V30, K31, V31, T30, T31, T32),
          NewT3 = two(K31, V31, T31, T32),
          Node = two(K2, V2, T2, T30),
          Tout = four(K0, V0, K1, V1, K30, V30, T0, T1, Node, NewT3),
          RH = no
      ;
-        % move T2 one level down to become the leftmost subtree of T3
+        % Move T2 one level down to become the leftmost subtree of T3.
          T3 = two(K30, V30, T30, T31),
          NewT3 = three(K2, V2, K30, V30, T2, T30, T31),
          Tout = three(K0, V0, K1, V1, T0, T1, NewT3),
@@ -2316,26 +2312,26 @@
  :- pred fix_4node_t3(K, V, K, V, K, V,
      tree234(K, V), tree234(K, V), tree234(K, V), tree234(K, V),
      tree234(K, V), bool).
-:- mode fix_4node_t3(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
+%:- mode fix_4node_t3(di, di, di, di, di, di, di, di, di, di, uo, out) is det.
  :- mode fix_4node_t3(in, in, in, in, in, in, in, in, in, in, out, out) is det.

  fix_4node_t3(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3, Tout, RH) :-
      (
-        % steal T2's rightmost subtree and combine it with T3
+        % Steal T2's rightmost subtree and combine it with T3.
          T2 = four(K20, V20, K21, V21, K22, V22, T20, T21, T22, T23),
          NewT2 = three(K20, V20, K21, V21, T20, T21, T22),
          Node = two(K2, V2, T23, T3),
          Tout = four(K0, V0, K1, V1, K22, V22, T0, T1, NewT2, Node),
          RH = no
      ;
-        % steal T2's rightmost subtree and combine it with T3
+        % Steal T2's rightmost subtree and combine it with T3.
          T2 = three(K20, V20, K21, V21, T20, T21, T22),
          NewT2 = two(K20, V20, T20, T21),
          Node = two(K2, V2, T22, T3),
          Tout = four(K0, V0, K1, V1, K21, V21, T0, T1, NewT2, Node),
          RH = no
      ;
-        % move T3 one level down to become the rightmost subtree of T2
+        % Move T3 one level down to become the rightmost subtree of T2.
          T2 = two(K20, V20, T20, T21),
          NewT2 = three(K20, V20, K2, V2, T20, T21, T3),
          Tout = three(K0, V0, K1, V1, T0, T1, NewT2),
@@ -2422,7 +2418,7 @@
      tree234.tree234_to_assoc_list_2(T1, [K1 - V1 | L1], L2),
      tree234.tree234_to_assoc_list_2(T0, [K0 - V0 | L2], L).
  tree234.tree234_to_assoc_list_2(four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3),
-                    L0, L) :-
+        L0, L) :-
      tree234.tree234_to_assoc_list_2(T3, L0, L1),
      tree234.tree234_to_assoc_list_2(T2, [K2 - V2 | L1], L2),
      tree234.tree234_to_assoc_list_2(T1, [K1 - V1 | L2], L3),
@@ -2646,9 +2642,9 @@
      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) ),
+    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) ),
+    P = (pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
      tree234.map_values(P, T1, T2).


--------------------------------------------------------------------------
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