[m-dev.] trivial diff: add functions for bool

Peter Ross peter.ross at miscrit.be
Fri Nov 3 01:42:22 AEDT 2000


Hi,


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


Estimated hours taken: 0.25

library/bool.m:
    Add functional forms of the bool predicates.


Index: bool.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bool.m,v
retrieving revision 1.5
diff -u -r1.5 bool.m
--- bool.m	1998/01/23 12:33:12	1.5
+++ bool.m	2000/11/02 14:03:42
@@ -28,18 +28,23 @@
 
 :- type bool ---> no ; yes.
 
+:- func bool__or(bool, bool) = bool.
 :- pred bool__or(bool, bool, bool).
 :- mode bool__or(in, in, out) is det.
 
+:- func bool__or_list(list(bool)) = bool.
 :- pred bool__or_list(list(bool), bool).
 :- mode bool__or_list(in, out) is det.
 
+:- func bool__and(bool, bool) = bool.
 :- pred bool__and(bool, bool, bool).
 :- mode bool__and(in, in, out) is det.
 
+:- func bool__and_list(list(bool)) = bool.
 :- pred bool__and_list(list(bool), bool).
 :- mode bool__and_list(in, out) is det.
 
+:- func bool__not(bool) = bool.
 :- pred bool__not(bool, bool).
 :- mode bool__not(in, out) is det.
 
@@ -47,9 +52,13 @@
 
 :- implementation.
 
+bool__or(X, Y) = Result :- bool__or(X, Y, Result).
+
 bool__or(yes, _, yes).
 bool__or(no, Bool, Bool).
 
+bool__or_list(List) = Result :- bool__or_list(List, Result).
+
 bool__or_list([], no).
 bool__or_list([Bool | Bools], Result) :-
 	( Bool = yes ->
@@ -58,9 +67,13 @@
 		bool__or_list(Bools, Result)
 	).
 
+bool__and(X, Y) = Result :- bool__and(X, Y, Result).
+
 bool__and(no, _, no).
 bool__and(yes, Bool, Bool).
 
+bool__and_list(List) = Result :- bool__and_list(List, Result).
+
 bool__and_list([], yes).
 bool__and_list([Bool | Bools], Result) :-
 	( Bool = no ->
@@ -68,6 +81,8 @@
 	;
 		bool__and_list(Bools, Result)
 	).
+
+bool__not(X) = Result :- bool__not(X, Result).
 
 bool__not(no, yes).
 bool__not(yes, no).

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