[m-rev.] Added int:'/'/2 and builtin false/0

Ralph Becket rafe at cs.mu.OZ.AU
Fri May 17 15:26:21 AEST 2002


Estimated hours taken: 1
Branches: main

NEWS:
	Record addition of int:'/'/2 as a synonym for int:'//'/2 and
	builtin false/0 as a synonym for fail/0.

library/int.m:
	Added '/'/2.

library/builtin.m:
	Added false/0.

Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.257
diff -u -r1.257 NEWS
--- NEWS	13 May 2002 03:19:43 -0000	1.257
+++ NEWS	17 May 2002 05:19:30 -0000
@@ -239,6 +239,10 @@
   `float__builtin_float_*' predicates, which were synonyms
   for the arithmetic functions dating from when Mercury didn't
   have functions. 
+
+* We've added int:'/'/2 as a synonym for int:'//'/2 and false/0 as a
+  built-in synonym for fail/0 (both left-overs from Mercury's Prolog
+  heritage.)
   
 * We've removed the long obsolete predicates `io__read_anything',
   `io__write_anything', and `io__print_anything', which were long ago
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.69
diff -u -r1.69 builtin.m
--- library/builtin.m	13 Mar 2002 12:25:34 -0000	1.69
+++ library/builtin.m	17 May 2002 02:46:30 -0000
@@ -129,6 +129,12 @@
 :- func unsafe_promise_unique(T) = T.
 :- mode unsafe_promise_unique(in) = uo is det.
 
+% A synonym for fail/0; the name is more in keeping with Mercury's
+% declarative style rather than its Prolog heritage.
+
+:- pred false.
+:- mode false is failure.
+
 %-----------------------------------------------------------------------------%
 
 % A call to the function `promise_only_solution(Pred)' constitutes a
@@ -243,6 +249,10 @@
 
 :- implementation.
 :- import_module require, string, std_util, int, float, char, string, list.
+
+%-----------------------------------------------------------------------------%
+
+false :- fail.
 
 %-----------------------------------------------------------------------------%
 
Index: library/int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.84
diff -u -r1.84 int.m
--- library/int.m	15 Mar 2002 05:13:53 -0000	1.84
+++ library/int.m	17 May 2002 04:51:25 -0000
@@ -119,6 +119,12 @@
 :- func int // int = int.
 :- mode in  // in  = uo  is det.
 
+	% A synonym for '//'/2.  '//'/2 is a relic from Mercury's
+	% Prolog heritage.
+	%
+:- func int / int = int.
+:- mode in / in = uo is det.
+
 	% unchecked_quotient(X, Y) is the same as X // Y, but the
 	% behaviour is undefined if the right operand is zero.
 :- func unchecked_quotient(int, int) = int.
@@ -300,6 +306,9 @@
 	;
 		Div = Trunc - 1
 	).
+
+:- pragma inline('/'/2).
+X / Y = X // Y.
 
 :- pragma inline('//'/2).
 X // Y = Div :-
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list