cvs diff: change arg order for arg/3

Tyson Richard DOWD trd at hydra.cs.mu.oz.au
Fri Mar 14 15:21:19 AEDT 1997


Hiya folks,

Ummmm.... DJ can you please review this?

===================================================================

Estimated hours taken: 0.5

library/std_util.m:
	Change the order of arguments in arg/3 to match the order in
	Prolog.

tests/hard_coded/elim_special_pred.m:
tests/hard_coded/expand.m:
	Change usage of arg/3 to conform to new code.


Index: library/std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.74
diff -u -r1.74 std_util.m
--- std_util.m	1997/03/06 20:03:48	1.74
+++ std_util.m	1997/03/13 03:52:25
@@ -139,7 +139,7 @@
 
 :- pred functor(T::in, string::out, int::out) is det.
 
-	% arg(Data, ArgumentIndex, Argument), given a data item (Data)
+	% arg(ArgumentIndex, Data, Argument), given a data item (Data)
 	% and an argument index (ArgumentIndex), starting at 1 for the
 	% first argument, binds Argument to that argument of the functor
 	% of the data item. If the argument index is out of range -
@@ -147,16 +147,16 @@
 	% arg/3 fails.
 	% The argument has the type univ. 
 
-:- pred arg(T::in, int::in, univ::out) is semidet.
+:- pred arg(int::in, T::in, univ::out) is semidet.
 
-	% det_arg(Data, ArgumentIndex, Argument), given a data item (Data)
+	% det_arg(ArgumentIndex, Data, Argument), given a data item (Data)
 	% and an argument index (ArgumentIndex), starting at 1 for the
 	% first argument, binds Argument to that argument of the functor
 	% of the data item. If the argument index is out of range -
 	% that is higher than the arity of the functor or lower than 1,
 	% det_arg/3 aborts. 
 
-:- pred det_arg(T::in, int::in, univ::out) is det.
+:- pred det_arg(int::in, T::in, univ::out) is det.
 
 	% expand(Data, Functor, Arity, Arguments), given a data item (Data),
 	% binds Functor to a string representation of the functor,
@@ -1362,7 +1362,7 @@
 
 }").
 
-:- pragma(c_code, arg(Type::in, ArgumentIndex::in, Argument::out), " 
+:- pragma(c_code, arg(ArgumentIndex::in, Type::in, Argument::out), " 
 {
 	expand_info info;
 	Word arg_pseudo_type_info;
@@ -1404,9 +1404,9 @@
 
 }").
 
-det_arg(Type, ArgumentIndex, Argument) :-
+det_arg(ArgumentIndex, Type, Argument) :-
 	(
-		arg(Type, ArgumentIndex, Argument0)
+		arg(ArgumentIndex, Type, Argument0)
 	->
 		Argument = Argument0
 	;
Index: tests/hard_coded/elim_special_pred.m
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/elim_special_pred.m,v
retrieving revision 1.1
diff -u -r1.1 elim_special_pred.m
--- elim_special_pred.m	1997/02/20 23:04:10	1.1
+++ elim_special_pred.m	1997/03/13 03:53:19
@@ -28,8 +28,8 @@
 main -->
 	{ X = banana(three) },
 	{ Y = banana(two) },
-	{ det_arg(X, 1, XArg) },
-	{ det_arg(Y, 1, YArg) },
+	{ det_arg(1, X, XArg) },
+	{ det_arg(1, Y, YArg) },
 	( 
 		{ XArg = YArg }
 	->
Index: tests/hard_coded/expand.m
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/expand.m,v
retrieving revision 1.1
diff -u -r1.1 expand.m
--- expand.m	1997/01/14 01:26:04	1.1
+++ expand.m	1997/03/13 03:53:40
@@ -84,7 +84,7 @@
 test_arg(T) -->
 	{ functor(T, Functor, Arity) },
 	( 
-		{ arg(T, Arity, Argument) }
+		{ arg(Arity, T, Argument) }
 	->
 		{ string__format("argument %d of functor %s was:", [i(Arity),
 			s(Functor)], Str) },

-- 
       Tyson Dowd           # "Well, let's just say, 'if your VCR is
                            #  still blinking 12:00, you don't
     trd at cs.mu.oz.au        #  want Linux'". 
http://www.cs.mu.oz.au/~trd #  --Bruce Perens, Debian's Fearless Leader



More information about the developers mailing list