[m-rev.] diff: style cleanups

Zoltan Somogyi zs at csse.unimelb.edu.au
Thu Aug 5 16:53:26 AEST 2010


browser/browser_info.m:
extras/gator/evolve.m:
extras/gator/genotype.m:
extras/gator/phenotype.m:
extras/gator/tausworthe3.m:
extras/lazy_evaluation/lazy.m:
extras/lazy_evaluation/lazy_list.m:
extras/lex/lex.automata.m:
extras/lex/lex.buf.m:
extras/lex/lex.convert_NFA_to_DFA.m:
extras/lex/lex.lexeme.m:
extras/lex/lex.lex.m:
extras/lex/lex.regexp.m:
extras/lex/regex.m:
library/graph.m:
library/list.m:
library/relation.m:
library/string.m:
	A whole bunch of style cleanups. There are no algorithmic changes.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing CVSROOT
cvs diff: Diffing analysis
cvs diff: Diffing bench
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
Index: browser/browser_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/browser_info.m,v
retrieving revision 1.36
diff -u -b -r1.36 browser_info.m
--- browser/browser_info.m	30 Aug 2009 23:09:42 -0000	1.36
+++ browser/browser_info.m	5 Aug 2010 06:19:28 -0000
@@ -410,22 +410,22 @@
     CallerType = !.Info ^ caller_type,
     set_browser_param_from_option_table(CallerType, OptionTable, Setting,
         PersistentState0, PersistentState),
-    !:Info = !.Info ^ state := PersistentState.
+    !Info ^ state := PersistentState.
 
 info_set_num_io_actions(N, !Info) :-
     PersistentState0 = !.Info ^ state,
     set_num_io_actions(N, PersistentState0, PersistentState),
-    !:Info = !.Info ^ state := PersistentState.
+    !Info ^ state := PersistentState.
 
 info_set_xml_browser_cmd(Cmd, !Info) :-
     PersistentState0 = !.Info ^ state,
     set_xml_browser_cmd_from_mdb(Cmd, PersistentState0, PersistentState),
-    !:Info = !.Info ^ state := PersistentState.
+    !Info ^ state := PersistentState.
 
 info_set_xml_tmp_filename(FileName, !Info) :-
     PersistentState0 = !.Info ^ state,
     set_xml_tmp_filename_from_mdb(FileName, PersistentState0, PersistentState),
-    !:Info = !.Info ^ state := PersistentState.
+    !Info ^ state := PersistentState.
 
 :- pred set_format_from_mdb(bool::in, bool::in, bool::in, portray_format::in,
     browser_persistent_state::in, browser_persistent_state::out) is det.
@@ -450,7 +450,7 @@
     "ML_BROWSE_set_num_io_actions").
 
 set_num_io_actions(NumIOActions, !Browser) :-
-    !:Browser = !.Browser ^ num_printed_io_actions := NumIOActions.
+    !Browser ^ num_printed_io_actions := NumIOActions.
 
 :- pred get_xml_browser_cmd_from_mdb(browser_persistent_state::in,
     string::out) is det.
@@ -475,9 +475,9 @@
 
 set_xml_browser_cmd_from_mdb(Command, !Browser) :-
     ( Command = "" ->
-        !:Browser = !.Browser ^ xml_browser_cmd := no
+        !Browser ^ xml_browser_cmd := no
     ;
-        !:Browser = !.Browser ^ xml_browser_cmd := yes(Command)
+        !Browser ^ xml_browser_cmd := yes(Command)
     ).
 
 :- pred get_xml_tmp_filename_from_mdb(browser_persistent_state::in,
@@ -503,9 +503,9 @@
 
 set_xml_tmp_filename_from_mdb(FileName, !Browser) :-
     ( FileName = "" ->
-        !:Browser = !.Browser ^ xml_tmp_filename := no
+        !Browser ^ xml_tmp_filename := no
     ;
-        !:Browser = !.Browser ^ xml_tmp_filename := yes(FileName)
+        !Browser ^ xml_tmp_filename := yes(FileName)
     ).
 
 %
@@ -780,7 +780,7 @@
 maybe_set_param(yes, F, Pr, V, NPr, Setting, !Params) :-
     (
         Setting = setting_format(NewFormat),
-        !:Params = !.Params ^ default_format := NewFormat
+        !Params ^ default_format := NewFormat
     ;
         ( Setting = setting_depth(_)
         ; Setting = setting_width(_)
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
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/concurrency
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
Index: extras/gator/evolve.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/gator/evolve.m,v
retrieving revision 1.1.1.1
diff -u -b -r1.1.1.1 evolve.m
--- extras/gator/evolve.m	13 Feb 2006 01:42:02 -0000	1.1.1.1
+++ extras/gator/evolve.m	5 Aug 2010 06:19:30 -0000
@@ -59,9 +59,7 @@
 %-----------------------------------------------------------------------------%
 
 main(!IO) :-
-
 		% Process any command line arguments.
-		%
 	io.command_line_arguments(Args, !IO),
 	OptionOps = option_ops_multi(short_option, long_option, option_default),
 	getopt.process_options(OptionOps, Args, _, Result),
@@ -85,30 +83,26 @@
 	),
 
 		% Read the input files.
-		%
     read_config_file(PathToConfigFile, Weightings, Flags, !IO),
 	genotype.read_genotypes(PathToGenotypes, Genotypes, !IO),
 	phenotype.read_phenotypes(PathToPhenotypes, Phenotypes, !IO),
 
 		% Apply the genetic operators to the genotypes.
-		%
 	some [!RNG] (
 		Tausworthe3Seed = tausworthe3_seed(FirstSeed, SecondSeed, ThirdSeed),
 		!:RNG = init_tausworthe3,
 		seed(Tausworthe3Seed, !RNG),
 
-			% We ensure that the following condition is held:
+        % We ensure that the following condition holds:
 			%
 			%	length(Genotypes) / 2 = length(Mothers) = length(Fathers).
 			%
 			% Since the crossover/6 predicate creates two children for
 			% every two parents, the population will remain constant
-			% over generations.  This is a simple way of avoiding
-			% extinction.
+        % over generations. This is a simple way of avoiding extinction.
 			%
-			% Note that map_2in_2out_foldl/7 will simply ignore leftover
-			% elements if the two lists (Mothers and Fathers) are of
-			% unequal lengths.
+        % Note that map_2in_2out_foldl/7 will simply ignore leftover elements
+        % if the two lists (Mothers and Fathers) are of unequal lengths.
 			%
 		Fitness = list.map(phenotype.fitness(Weightings), Phenotypes),
 		list.map_foldl(phenotype.selection(Genotypes, Fitness),
@@ -122,7 +116,6 @@
 	),
 
 		% Print the output files.
-		%
 	genotype.print_genotypes(PathToNextGenotypes, NextGenotypes, !IO),
     print_ladder(PathToLadder, Fitness, Genotypes, !IO).
 
@@ -130,8 +123,6 @@
 %
 % Command line argument parsing.
 %
-
-%
 % This section contains all the code for the predicates required by
 % getopt.process_options.
 %
Index: extras/gator/genotype.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/gator/genotype.m,v
retrieving revision 1.2
diff -u -b -r1.2 genotype.m
--- extras/gator/genotype.m	15 Sep 2006 09:11:24 -0000	1.2
+++ extras/gator/genotype.m	5 Aug 2010 06:19:30 -0000
@@ -32,7 +32,7 @@
 	%
 :- pred read_genotypes(string::in, list(genotype)::out, io::di, io::uo) is det.
 
-	% crossover(Mother, Father, Son, Daughter, !RNG).
+    % crossover(Mother, Father, Son, Daughter, !RNG):
 	%
 	% This predicate takes two parent genotypes and randomly selects
 	% optimisation flags from each to create two new child genotypes.
@@ -45,8 +45,8 @@
 	% used.  Many common crossover methods assume the genotype is a
 	% fixed-length bit-array.
 	%
-:- pred crossover(genotype::in, genotype::in, genotype::out,
-        genotype::out, RNG::in, RNG::out) is det <= random(RNG, Seed).
+:- pred crossover(genotype::in, genotype::in, genotype::out, genotype::out,
+    RNG::in, RNG::out) is det <= random(RNG, Seed).
 
 	% mutation(Flags, Child, Mutant, !RNG).
 	%
@@ -55,8 +55,8 @@
 	% This predicate is implemented by choosing a compiler flag at
 	% random and toggling that flag in the child genotype.
 	%
-:- pred mutation(list(flag)::in, genotype::in, genotype::out, RNG::in,
-        RNG::out) is det <= random(RNG, Seed).
+:- pred mutation(list(flag)::in, genotype::in, genotype::out,
+    RNG::in, RNG::out) is det <= random(RNG, Seed).
 
 	% print_genotypes(Path, Genotypes, !IO):
 	%
@@ -94,8 +94,6 @@
 %
 % Reading in a list of genotypes.
 %
-
-%
 % This section contains the implementation of the read_genotypes/4
 % predicate, which parses a file containing the flags to be passed to the
 % compiler.
@@ -113,12 +111,10 @@
 		io.read_file(Stream, ReadResult, !IO),
 		(
 			ReadResult = ok(File),
-			( if
-				many(genotype, Genotypes0, File, [])
-			then
+            ( many(genotype, Genotypes0, File, []) ->
 				Genotypes = Genotypes0,
 				io.close_input(Stream, !IO)
-			else
+            ;
 				require.error("parse error while reading genotypes")
 			)
 		;
@@ -136,11 +132,10 @@
 		list(T)::out, list(char)::in, list(char)::out) is semidet.
 
 many(P, Ps) -->
-	( if P(X)
-	then
+    ( P(X) ->
 		many(P, Xs),
 		{ Ps = [X | Xs] }
-	else
+    ;
 		{ Ps = [] }
 	).
 
@@ -159,8 +154,8 @@
 	many(other, Others),
 	{ Flag = string.from_char_list(DoubleDash ++ Others) }.
 
-:- pred double_dash(list(char)::out, list(char)::in, list(char)::out) is
-        semidet.
+:- pred double_dash(list(char)::out, list(char)::in, list(char)::out)
+    is semidet.
 
 double_dash(DoubleDash) -->
 	['-', '-'],
@@ -177,8 +172,6 @@
 %
 % Genetic operators that operate on the genotype.
 %
-
-%
 % This section contains the predicates for the genetic operators that
 % require access to (and knowledge of) the representation of the genotype.
 % These include the crossover (or recombination) and mutation operators.
@@ -193,13 +186,13 @@
         RNG::out) is det <= random(RNG, Seed).
 
 cut(Parent, PartOfSon, PartOfDaughter, !RNG) :-
-	( if
+    (
 		set.count(Parent, NumFlags),
 		NumFlags \= 0
-	then
+    ->
 		next(NextRandomInt, !RNG),
 		CrossoverPoint = NextRandomInt mod NumFlags
-	else
+    ;
 		CrossoverPoint = 0
 	),
 	set.to_sorted_list(Parent, List),
@@ -214,11 +207,9 @@
 	Index = Next mod NumFlags,
 	list.index0_det(Flags, Index, Flag),
 
-	( if
-		set.member(Flag, !.Genotype)
-	then
+    ( set.member(Flag, !.Genotype) ->
 		svset.delete(Flag, !Genotype)
-	else
+    ;
 		svset.insert(Flag, !Genotype)
 	).
 
@@ -226,8 +217,6 @@
 %
 % Printing out a list of genotypes.
 %
-
-%
 % This section contains the implementation of the print_genotypes/4
 % predicate, which creates a file containing the flags to be passed to the
 % compiler.
Index: extras/gator/phenotype.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/gator/phenotype.m,v
retrieving revision 1.1.1.1
diff -u -b -r1.1.1.1 phenotype.m
--- extras/gator/phenotype.m	13 Feb 2006 01:42:02 -0000	1.1.1.1
+++ extras/gator/phenotype.m	5 Aug 2010 06:19:30 -0000
@@ -26,26 +26,23 @@
 
 :- type fitness.
 
-	% read_phenotypes(Path, Phenotypes, !IO).
+    % read_phenotypes(Path, Phenotypes, !IO):
 	%
-	% Reads a list of phenotypes from the given file, and unifies
-	% the list with Phenotypes.
+    % Reads a list of phenotypes from the given file.
 	%
-:- pred read_phenotypes(string::in, list(phenotype)::out, io::di,
-        io::uo) is det.
+:- pred read_phenotypes(string::in, list(phenotype)::out, io::di, io::uo)
+    is det.
 
-	% fitness(Weightings, Phenotype) = Fitness.
+    % fitness(Weightings, Phenotype) = Fitness:
 	%
-	% This function evaluates the fitness of a genotype given its
-	% phenotype.
+    % This function evaluates the fitness of a genotype given its phenotype.
 	%
 	% Fitness is defined here as a weighted sum of each number in the
-	% phenotype.  The weightings can be modified by changing the
-	% "Weightings" variable.
+    % phenotype. The weightings are given by Weightings.
 	%
 :- func fitness(list(weighting), phenotype) = fitness is det.
 
-	% selection(Genotypes, Fitness, _, Parent, !RNG).
+    % selection(Genotypes, Fitness, _, Parent, !RNG):
 	%
 	% This predicate randomly selects an individual for reproduction.
 	%
@@ -131,37 +128,30 @@
     Fitness = 1.0 / SumOfWeightedBenchmarks.
 
 selection(Genotypes, Fitness, _, Parent, !RNG) :-
-
-		% Normalise fitness values.  The sum of all the
-		% normalised fitness values should be equal to 1.0.  This
-		% is achieved by dividing each of the fitness values by
-		% the sum of the fitness values.
-		%
+    % Normalise fitness values. The sum of all the normalised fitness values
+    % should be equal to 1.0. This is achieved by dividing each of the
+    % fitness values by the sum of the fitness values.
 	list.foldl(+, Fitness, 0.0) = Sum,
 	list.map(std_util.converse(/, Sum), Fitness) = NormalFitness,
 
-		% Find the accumulated normalised fitness values.  The
-		% accumulated normalised fitness value is the sum of the
-		% normalised fitness values for the current and all
-		% previous genotypes.
-		%
+    % Find the accumulated normalised fitness values. The accumulated
+    % normalised fitness value is the sum of the normalised fitness values
+    % for the current and all previous genotypes.
 	list.map_foldl(pred(X::in, X + Y::out, Y::in, X + Y::out) is det,
 			NormalFitness, CumulativeNormalFitness, 0.0, _),
 
 		% Pick a random number between zero and one.
-		%
 	next(Int, !RNG),
 	max(Maximum, !RNG),
 	Float = float(Int) / float(Maximum),
 
-		% Find the first cumulative normalised fitness value that is
-		% greater than or equal to the random number picked, and find its
-		% corresponding genotype.
-		%
-		% Note that we're guaranteed to have at least one element
-		% in AfterList, since the last element of
-		% CumulativeNormalFitness (and therefore AfterList) is
-		% exactly 1.0, and Float is no greater than 1.0.
+    % Find the first cumulative normalised fitness value that is greater than
+    % or equal to the random number picked, and find its corresponding
+    % genotype.
+    %
+    % Note that we're guaranteed to have at least one element in AfterList,
+    % since the last element of CumulativeNormalFitness (and therefore
+    % AfterList) is exactly 1.0, and Float is no greater than 1.0.
 		%
 	list.takewhile(>(Float), CumulativeNormalFitness, _, AfterList),
 	Head = list.det_head(AfterList),
@@ -175,7 +165,7 @@
 % Miscellaneous.
 %
 
-    % map_2in_1out(T, L, M) = N.
+    % map_2in_1out(T, L, M) = N:
     %
     % This function is the same as list.map2/4, except that it takes two
     % input lists.  Obviously it is also a function, unlike list.map2/4.
Index: extras/gator/tausworthe3.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/gator/tausworthe3.m,v
retrieving revision 1.1.1.1
diff -u -b -r1.1.1.1 tausworthe3.m
--- extras/gator/tausworthe3.m	13 Feb 2006 01:42:03 -0000	1.1.1.1
+++ extras/gator/tausworthe3.m	5 Aug 2010 06:19:30 -0000
@@ -12,8 +12,6 @@
 
 :- import_module int.
 
-
-
 :- type tausworthe3.
 
 :- func init_tausworthe3 = tausworthe3.
@@ -87,7 +85,6 @@
 init_tausworthe3 = state(0, 0, 0, consts(0, 0, 0, 0, 0, 0)).
 
 seed_tausworthe3(A, B, C) = R :-
-
 	P1     = 12,
 	P2     =  4,
 	P3     = 17,
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_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
Index: extras/lazy_evaluation/lazy.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lazy_evaluation/lazy.m,v
retrieving revision 1.5
diff -u -b -r1.5 lazy.m
--- extras/lazy_evaluation/lazy.m	27 Jul 2010 21:05:29 -0000	1.5
+++ extras/lazy_evaluation/lazy.m	5 Aug 2010 06:19:31 -0000
@@ -80,8 +80,6 @@
 %
 %-----------------------------------------------------------------------------%
 
-%-----------------------------------------------------------------------------%
-
 :- implementation.
 :- interface.
     
@@ -129,10 +127,8 @@
             Lazy = closure(Func),
             Value = apply(Func),
 
-                % Destructively update the Lazy cell with the value
-                % to avoid having to recompute the same result
-                % next time.
-                %
+            % Destructively update the Lazy cell with the value to avoid
+            % having to recompute the same result next time.
             impure update_in_place(Lazy, value(Value))
         )
     ).
Index: extras/lazy_evaluation/lazy_list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lazy_evaluation/lazy_list.m,v
retrieving revision 1.3
diff -u -b -r1.3 lazy_list.m
--- extras/lazy_evaluation/lazy_list.m	27 Jul 2010 22:33:46 -0000	1.3
+++ extras/lazy_evaluation/lazy_list.m	5 Aug 2010 06:19:31 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ts=4 sw=4 et ft=mercury
+%-----------------------------------------------------------------------------%
 %
 % This is an example of how to use the `lazy' module to define
 % a recursive lazy data type, in this case lazy lists.
cvs diff: Diffing extras/lex
Index: extras/lex/lex.automata.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.automata.m,v
retrieving revision 1.2
diff -u -b -r1.2 lex.automata.m
--- extras/lex/lex.automata.m	3 Dec 2002 04:48:31 -0000	1.2
+++ extras/lex/lex.automata.m	5 Aug 2010 06:19:31 -0000
@@ -1,6 +1,7 @@
 %-----------------------------------------------------------------------------%
-% lex.automata.m
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
+%-----------------------------------------------------------------------------%
+% lex.automata.m
 % Copyright (C) 2001 Ralph Becket <rbeck at microsoft.com>
 % Copyright (C) 2002 The University of Melbourne
 %
Index: extras/lex/lex.buf.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.buf.m,v
retrieving revision 1.3
diff -u -b -r1.3 lex.buf.m
--- extras/lex/lex.buf.m	3 Dec 2002 04:48:32 -0000	1.3
+++ extras/lex/lex.buf.m	5 Aug 2010 06:19:31 -0000
@@ -1,6 +1,6 @@
 %-----------------------------------------------------------------------------%
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
-%
+%-----------------------------------------------------------------------------%
 % lex.buf.m
 % Copyright (C) 2001 Ralph Becket <rbeck at microsoft.com>
 % Copyright (C) 2002 The University of Melbourne
Index: extras/lex/lex.convert_NFA_to_DFA.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.convert_NFA_to_DFA.m,v
retrieving revision 1.3
diff -u -b -r1.3 lex.convert_NFA_to_DFA.m
--- extras/lex/lex.convert_NFA_to_DFA.m	3 Dec 2002 04:48:32 -0000	1.3
+++ extras/lex/lex.convert_NFA_to_DFA.m	5 Aug 2010 06:19:31 -0000
@@ -1,5 +1,6 @@
 %----------------------------------------------------------------------------
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
+%----------------------------------------------------------------------------
 %
 % lex.convert_NFA_to_DFA.m
 % Copyright (C) 2001 Ralph Becket <rbeck at microsoft.com>
Index: extras/lex/lex.lexeme.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.lexeme.m,v
retrieving revision 1.4
diff -u -b -r1.4 lex.lexeme.m
--- extras/lex/lex.lexeme.m	4 Jun 2007 07:59:07 -0000	1.4
+++ extras/lex/lex.lexeme.m	5 Aug 2010 06:19:31 -0000
@@ -1,7 +1,7 @@
 %----------------------------------------------------------------------------
-%
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
 %
+%
 % lex.lexeme.m
 % Sat Aug 19 08:22:32 BST 2000
 % Copyright (C) 2001 Ralph Becket <rbeck at microsoft.com>
Index: extras/lex/lex.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.m,v
retrieving revision 1.7
diff -u -b -r1.7 lex.m
--- extras/lex/lex.m	21 Aug 2008 06:41:52 -0000	1.7
+++ extras/lex/lex.m	5 Aug 2010 06:19:31 -0000
@@ -1,5 +1,6 @@
 %-----------------------------------------------------------------------------%
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
+%-----------------------------------------------------------------------------%
 %
 % lex.m
 % Copyright (C) 2001-2002 Ralph Becket <rbeck at microsoft.com>
Index: extras/lex/lex.regexp.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/lex.regexp.m,v
retrieving revision 1.3
diff -u -b -r1.3 lex.regexp.m
--- extras/lex/lex.regexp.m	3 Dec 2002 04:48:32 -0000	1.3
+++ extras/lex/lex.regexp.m	5 Aug 2010 06:19:31 -0000
@@ -1,5 +1,6 @@
 %-----------------------------------------------------------------------------%
 % vim: ts=4 sw=4 et tw=0 wm=0 ff=unix
+%-----------------------------------------------------------------------------%
 %
 % lex.regexp.m
 % Fri Aug 18 06:43:09 BST 2000
Index: extras/lex/regex.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/lex/regex.m,v
retrieving revision 1.3
diff -u -b -r1.3 regex.m
--- extras/lex/regex.m	21 Aug 2008 06:41:52 -0000	1.3
+++ extras/lex/regex.m	5 Aug 2010 06:19:31 -0000
@@ -1,8 +1,9 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % regex.m
 % Ralph Becket <rafe at cs.mu.oz.au>
 % Copyright (C) 2002, 2006 The University of Melbourne
-% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %
 % This module provides basic string matching and search and replace
 % functionality using regular expressions defined as strings of the
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/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/graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.34
diff -u -b -r1.34 graph.m
--- library/graph.m	24 Oct 2006 02:59:46 -0000	1.34
+++ library/graph.m	5 Aug 2010 06:19:32 -0000
@@ -209,16 +209,16 @@
 graph.set_node(!.G, NInfo, node(N), !:G) :-
     NS0 = !.G ^ node_supply,
     counter.allocate(N, NS0, NS),
-    !:G = !.G ^ node_supply := NS,
+    !G ^ node_supply := NS,
 
     Nodes0 = !.G ^ node_map,
     map.set(Nodes0, node(N), NInfo, Nodes),
-    !:G = !.G ^ node_map := Nodes,
+    !G ^ node_map := Nodes,
 
     Edges0 = !.G ^ edge_map,
     map.init(EdgeMap),
     map.set(Edges0, node(N), EdgeMap, Edges),
-    !:G = !.G ^ edge_map := Edges.
+    !G ^ edge_map := Edges.
 
 graph.det_insert_node(!.G, NInfo, N, !:G) :-
     ( graph.insert_node(!.G, NInfo, NPrime, !:G) ->
@@ -233,16 +233,16 @@
 
     NS0 = !.G ^ node_supply,
     counter.allocate(N, NS0, NS),
-    !:G = !.G ^ node_supply := NS,
+    !G ^ node_supply := NS,
 
     Nodes0 = !.G ^ node_map,
     map.set(Nodes0, node(N), NInfo, Nodes),
-    !:G = !.G ^ node_map := Nodes,
+    !G ^ node_map := Nodes,
 
     Edges0 = !.G ^ edge_map,
     map.init(EdgeSet),
     map.set(Edges0, node(N), EdgeSet, Edges),
-    !:G = !.G ^ edge_map := Edges.
+    !G ^ edge_map := Edges.
 
 %------------------------------------------------------------------------------%
 
@@ -289,17 +289,17 @@
     AS0 = !.G ^ arc_supply,
     counter.allocate(A, AS0, AS),
     Arc = arc(A),
-    !:G = !.G ^ arc_supply := AS,
+    !G ^ arc_supply := AS,
 
     Arcs0 = !.G ^ arc_map,
     map.set(Arcs0, Arc, arc_info(Start, End, Info), Arcs),
-    !:G = !.G ^ arc_map := Arcs,
+    !G ^ arc_map := Arcs,
 
     Es0 = !.G ^ edge_map,
     map.lookup(Es0, Start, EdgeMap0),
     map.set(EdgeMap0, Arc, End, EdgeMap),
     map.set(Es0, Start, EdgeMap, Es),
-    !:G = !.G ^ edge_map := Es.
+    !G ^ edge_map := Es.
 
 %------------------------------------------------------------------------------%
 
@@ -314,17 +314,17 @@
     AS0 = !.G ^ arc_supply,
     counter.allocate(A, AS0, AS),
     Arc = arc(A),
-    !:G = !.G ^ arc_supply := AS,
+    !G ^ arc_supply := AS,
 
     Arcs0 = !.G ^ arc_map,
     map.insert(Arcs0, Arc, arc_info(Start, End, Info), Arcs),
-    !:G = !.G ^ arc_map := Arcs,
+    !G ^ arc_map := Arcs,
 
     Es0 = !.G ^ edge_map,
     map.lookup(Es0, Start, EdgeMap0),
     map.set(EdgeMap0, Arc, End, EdgeMap),
     map.set(Es0, Start, EdgeMap, Es),
-    !:G = !.G ^ edge_map := Es.
+    !G ^ edge_map := Es.
 
 %------------------------------------------------------------------------------%
 
Index: library/list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.190
diff -u -b -r1.190 list.m
--- library/list.m	30 Jul 2010 05:16:26 -0000	1.190
+++ library/list.m	5 Aug 2010 06:19:32 -0000
@@ -2732,9 +2732,8 @@
 list.chunk(Xs, N) = Ys :-
     list.chunk(Xs, N, Ys).
 
-list.map(F, Xs) = Ys :-
-    P = ( pred(X::in, Y::out) is det :- Y = F(X) ),
-    list.map(P, Xs, Ys).
+list.map(_F, []) = [].
+list.map(F, [H | T]) = [F(H) | list.map(F, T)].
 
 list.foldl(F, Xs, A) = B :-
     P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
Index: library/relation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/relation.m,v
retrieving revision 1.45
diff -u -b -r1.45 relation.m
--- library/relation.m	7 Sep 2007 15:08:20 -0000	1.45
+++ library/relation.m	5 Aug 2010 06:19:32 -0000
@@ -786,22 +786,20 @@
 
 %------------------------------------------------------------------------------%
 
-    % relation cliques
-    %   take a relation and return the set of strongly connected
-    %   components
-    %
-    %   Works using the following algorith
-    %       1. Topologically sort the nodes.  Then number the nodes
-    %          so the highest num is the first node in the
-    %          topological sort.
-    %       2. Reverse the relation ie R'
-    %       3. Starting from the highest numbered node do a DFS on
-    %          R'.  All the nodes visited are a member of the cycle.
-    %       4. From the next highest non-visited node do a DFS on
-    %          R' (not including visited nodes).  This is the next
-    %          cycle.
-    %       5. Repeat step 4 until all nodes visited.
 relation.cliques(Rel, Cliques) :-
+    % Relation cliques takes a relation and returns the set of strongly
+    % connected components.
+    %
+    % It works using the following algorith.
+    % 1. Topologically sort the nodes.  Then number the nodes so the
+    %    highest num is the first node in the topological sort.
+    % 2. Reverse the relation, i.e. generate Rel'.
+    % 3. Starting from the highest numbered node do a DFS on Rel'.
+    %    All the nodes visited are a member of the cycle.
+    % 4. From the next highest non-visited node do a DFS on Rel'
+    %    (not including visited nodes). This is the next cycle.
+    % 5. Repeat step 4 until all nodes visited.
+
     % Effectively assigns a numbering to the nodes.
     relation.dfsrev(Rel, DfsRev),
     relation.inverse(Rel, RelInv),
@@ -810,24 +808,23 @@
     relation.cliques_2(DfsRev, RelInv, Visit, Cliques0, Cliques1),
     Cliques = set.map(to_set, Cliques1).
 
-:- pred relation.cliques_2(list(relation_key), relation(T),
-    relation_key_set, set(relation_key_set),
-    set(relation_key_set)).
-:- mode relation.cliques_2(in, in, in, in, out) is det.
+:- pred relation.cliques_2(list(relation_key)::in, relation(T)::in,
+    relation_key_set::in,
+    set(relation_key_set)::in, set(relation_key_set)::out) is det.
 
-relation.cliques_2([], _, _, Cliques, Cliques).
-relation.cliques_2([H | T0], RelInv, Visit0, Cliques0, Cliques) :-
+relation.cliques_2([], _, _, !Cliques).
+relation.cliques_2([H | T0], RelInv, Visit0, !Cliques) :-
     % Do a DFS on R'
     relation.dfs_2(RelInv, H, Visit0, Visit, [], StrongComponent),
 
     % Insert the cycle into the clique set.
     list_to_set(StrongComponent, StrongComponentSet),
-    set.insert(Cliques0, StrongComponentSet, Cliques1),
+    set.insert(!.Cliques, StrongComponentSet, !:Cliques),
 
-    % Delete all the visited elements, so first element of the list
+    % Delete all the visited elements, so the first element of the list
     % is the next highest number node.
     list.delete_elems(T0, StrongComponent, T),
-    relation.cliques_2(T, RelInv, Visit, Cliques1, Cliques).
+    relation.cliques_2(T, RelInv, Visit, !Cliques).
 
 %------------------------------------------------------------------------------%
 
@@ -904,9 +901,9 @@
     %
     % The algorithm used is described in:
     %
-    %   R. E. Tarjan, "Depth-first search and
-    %   linear graph algorithms,"  SIAM Journal
-    %   on Computing, 1, 2 (1972).
+    %   R. E. Tarjan, "Depth-first search and linear graph algorithms,"
+    %   SIAM Journal on Computing, 1, 2 (1972).
+
     relation.dfsrev(Rel, DfsRev),
     relation.inverse(Rel, RelInv),
     init(Visit),
@@ -940,15 +937,14 @@
     % relation.tc returns the transitive closure of a relation.
     % We use this procedure:
     %
-    %   - Compute the reflexive transitive closure.
-    %   - Find the "fake reflexives", that is, the
-    %     set of elements x for which xR+x should
-    %     not be true.  This is done by noting that
-    %     R+ = R . R* (where '.' denotes composition).
-    %     Therefore x is a fake reflexive iff the set
-    %     { x | yRx and xR*y } is empty.
-    %   - Remove those elements from the reflexive
-    %     transitive closure computed above.
+    % 1 Compute the reflexive transitive closure.
+    % 2 Find the "fake reflexives", that is, the set of elements x
+    %   for which xR+x should not be true. This is done by noting that
+    %   R+ = R . R* (where '.' denotes composition). Therefore x is a
+    %   fake reflexive iff the set { x | yRx and xR*y } is empty.
+    % 3 Remove those elements from the reflexive transitive closure
+    %   computed above.
+
     relation.rtc(Rel, Rtc),
 
     % Find the fake reflexives.
@@ -988,7 +984,7 @@
     % element in that clique. So we visit each clique in reverse topological
     % sorted order, compute the RTC for each element in the clique and then
     % add the appropriate arcs.
-    %
+
     relation.dfs(Rel, Dfs),
     init(Visit),
 
Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.297
diff -u -b -r1.297 string.m
--- library/string.m	2 Aug 2010 03:04:04 -0000	1.297
+++ library/string.m	5 Aug 2010 06:19:32 -0000
@@ -1334,7 +1334,7 @@
 % :- pred string.to_char_list(string, list(char)).
 % :- mode string.to_char_list(in, uo) is det.
 % :- mode string.to_char_list(uo, in) is det.
-:- pragma promise_pure(string.to_char_list/2).
+:- pragma promise_equivalent_clauses(string.to_char_list/2).
 
 string.to_char_list(Str::in, CharList::out) :-
     string.to_char_list_2(Str, CharList).
@@ -1396,7 +1396,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pragma promise_pure(string.from_char_list/2).
+:- pragma promise_equivalent_clauses(string.from_char_list/2).
 
 string.from_char_list(Chars::out, Str::in) :-
     string.to_char_list(Str, Chars).
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/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/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/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/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