[m-dev.] trivial diff: tests/hard_coded/*.m: avoid name clashes

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jul 8 19:51:02 AEST 1999


Estimated hours taken: 0.5

tests/hard_coded/boyer.m:
tests/hard_coded/curry.m:
tests/hard_coded/higher_order_func_test.m:
	Rename some things to avoid name clashes with functions recently
	added to the standard library.  The name clashes resulted in
	ambiguity errors during type checking.

Workspace: /home/mercury0/fjh/mercury
Index: tests/hard_coded/boyer.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/boyer.m,v
retrieving revision 1.2
diff -u -r1.2 boyer.m
--- boyer.m	1998/05/29 08:56:26	1.2
+++ boyer.m	1999/07/08 09:43:26
@@ -46,7 +46,7 @@
 		(implies(type_wff,type_wff) ;
 		 and(type_wff,type_wff) ;
 		 f(type_wff) ;
-		 plus(type_wff,type_wff) ;
+		 my_plus(type_wff,type_wff) ;
 		 equal1(type_wff,type_wff) ;
 		 append(type_wff,type_wff) ;
 		 lessp(type_wff,type_wff) ;
@@ -68,10 +68,10 @@
                     and(implies(Z,U),
                         implies(U,W)))),
             implies(X,W))) :-
-        X = f(plus(plus(a1,b1),plus(c1,zero))),
-        Y = f(times(times(a1,b1),plus(c1,d1))),
+        X = f(my_plus(my_plus(a1,b1),my_plus(c1,zero))),
+        Y = f(times(times(a1,b1),my_plus(c1,d1))),
         Z = f(reverse(append(append(a1,b1),nil))),
-        U = equal1(plus(a1,b1),difference(x1,y1)),
+        U = equal1(my_plus(a1,b1),difference(x1,y1)),
         W = lessp(remainder(a1,b1),b_member(a1,b_length(b1))).
 
 :- pred tautology(type_wff,list(type_wff),list(type_wff)) .
@@ -127,9 +127,9 @@
 	 New = Mid
 	) .
 
-rewrite(plus(X1,X2),New) :-
+rewrite(my_plus(X1,X2),New) :-
         rewrite(X1,Y1) , rewrite(X2,Y2) ,
-	Mid = plus(Y1,Y2) ,
+	Mid = my_plus(Y1,Y2) ,
 	(equal(Mid,Next) -> rewrite(Next,New)
 	;
 	 New = Mid
@@ -265,7 +265,7 @@
 equal(  lessp(A,B),
         C
         ) :- lessp1(A,B,C).
-equal(  plus(A,B),
+equal(  my_plus(A,B),
         C
         ) :- plus1(A,B,C).
 equal(  remainder(A,B),
@@ -281,9 +281,9 @@
 difference1(X,Y,Z) :-
 		(X = Y -> Z = zero
 		;
-		 (X = plus(A,B), Y = plus(A,C) -> Z = difference(B,C)
+		 (X = my_plus(A,B), Y = my_plus(A,C) -> Z = difference(B,C)
 		 ;
-		  X = plus(B,plus(Y,C)) -> Z = plus(B,C) ; fail
+		  X = my_plus(B,my_plus(Y,C)) -> Z = my_plus(B,C) ; fail
 		 )
 		) .
 
@@ -303,13 +303,13 @@
 % :- pred lessp1(type_wff,type_wff,type_wff) .
 :- mode lessp1(in,in,out) is semidet .
 
-lessp1(plus(X,Y), plus(X,Z), lessp(Y,Z)) .
+lessp1(my_plus(X,Y), my_plus(X,Z), lessp(Y,Z)) .
 
 % :- pred plus1(type_wff,type_wff,type_wff) .
 :- mode plus1(in,in,out) is semidet .
 
-plus1(plus(X,Y),Z,
-     plus(X,plus(Y,Z))).
+plus1(my_plus(X,Y),Z,
+     my_plus(X,my_plus(Y,Z))).
 
 % :- pred remainder1(type_wff,type_wff,type_wff) .
 :- mode remainder1(in,in,out) is semidet .
Index: tests/hard_coded/curry.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/curry.m,v
retrieving revision 1.1
diff -u -r1.1 curry.m
--- curry.m	1996/11/11 14:57:57	1.1
+++ curry.m	1999/07/08 09:44:40
@@ -12,8 +12,8 @@
 
 main -->
  	io__write_string("Hello, world\n"),
-	{ _ = map(curry2(append), [[1],[2],[3]]) },
-	{ _ = map(curry2(plus), [1,2,3]) }.
+	{ _ = my_map(curry2(append), [[1],[2],[3]]) },
+	{ _ = my_map(curry2(plus), [1,2,3]) }.
 
 :- func append(list(T), list(T)) = list(T).
 append(A, B) = C :- list__append(A, B, C).
@@ -29,10 +29,10 @@
 :- func plus(int, int) = int.
 plus(A, B) = A + B.
 
-:- func map(func(T1) = T2, list(T1)) = list(T2).
-% :- mode map(func(in) = out is det, in) = out is det.
-:- mode map(func(in) = out(func(in) = out is det) is det, in) = out is det.
+:- func my_map(func(T1) = T2, list(T1)) = list(T2).
+% :- mode my_map(func(in) = out is det, in) = out is det.
+:- mode my_map(func(in) = out(func(in) = out is det) is det, in) = out is det.
 
-map(_F, []) = [].
-map(F, [X|Xs]) = [apply(F,X)|map(F, Xs)].
+my_map(_F, []) = [].
+my_map(F, [X|Xs]) = [apply(F,X)|my_map(F, Xs)].
 
Index: tests/hard_coded/higher_order_func_test.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/higher_order_func_test.m,v
retrieving revision 1.4
diff -u -r1.4 higher_order_func_test.m
--- higher_order_func_test.m	1997/07/07 08:28:56	1.4
+++ higher_order_func_test.m	1999/07/08 09:41:05
@@ -6,20 +6,20 @@
 
 :- pred main(io__state::di, io__state::uo) is det.
 
-:- func map(func(X) = Y, list(X)) = list(Y).
-:- mode map(func(in) = out is det, in) = out is det.
-:- mode map(func(in) = out is semidet, in) = out is semidet.
+:- func my_map(func(X) = Y, list(X)) = list(Y).
+:- mode my_map(func(in) = out is det, in) = out is det.
+:- mode my_map(func(in) = out is semidet, in) = out is semidet.
 
 :- implementation.
 
-map(_, []) = [].
-map(F, [H0|T0]) = [apply(F, H0) | map(F, T0)].
+my_map(_, []) = [].
+my_map(F, [H0|T0]) = [apply(F, H0) | my_map(F, T0)].
 
 main -->
 	{ L1 = [1,2,3] },
-	{ L2 = map((func(X::in) = (Y::out) is det :- Y = 2*X), L1) },
-	{ L3 = map((func(X2) = Y2 :- Y2 = 5*X2), L2) },
-	{ L = map(func(X3) = 10*X3, L3) },
+	{ L2 = my_map((func(X::in) = (Y::out) is det :- Y = 2*X), L1) },
+	{ L3 = my_map((func(X2) = Y2 :- Y2 = 5*X2), L2) },
+	{ L = my_map(func(X3) = 10*X3, L3) },
 	list__foldl(io__write_int, L),
 	io__write_string("\n").
 
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list