Files
mercury/library/bool.m
Fergus Henderson 23b3e9d352 Undo dylan's changes in the names of some library entities,
Estimated hours taken: 1.5

Undo dylan's changes in the names of some library entities,
by applying the following sed script

	s/term_atom/term__atom/g
	s/term_string/term__string/g
	s/term_integer/term__integer/g
	s/term_float/term__float/g
	s/term_context/term__context/g
	s/term_functor/term__functor/g
	s/term_variable/term__variable/g
	s/_term__/_term_/g
	s/std_util__bool_/bool__/g

to all the `.m' and `.pp' files in the compiler and library directories.
The reason for undoing these changes was to minimize incompatibilities
with 0.4 (and besides, the changes were not a really good idea in the first
place).

I also moved `bool' from std_util.m to a separate module.
The main reason for that change is to ensure that the `__' prefix is
only used when it genuinely represents a module qualifier.
(That's what dylan's changes were trying to acheive, but `term__'
does genuinely represent a module qualifier.)

library/bool.m:
	New file, containing stuff previously in std_util.m.
library/*.m:
	Apply sed script above;
	where appropriate, add `bool' to the list of imported modules.
1996-02-03 17:37:07 +00:00

76 lines
1.9 KiB
Mathematica

%---------------------------------------------------------------------------%
% Copyright (C) 1995 University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%---------------------------------------------------------------------------%
% File: bool.m.
% Main authors: fjh, zs.
% Stability: medium to high.
% This module exports the boolean type `bool' and some operations on bools.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
:- module bool.
:- interface.
:- import_module list.
%-----------------------------------------------------------------------------%
% The boolean type.
% Unlike most languages, we use `yes' and `no' as boolean constants
% rather than `true' and `false'. This is to avoid confusion
% with the predicates `true' and `fail'.
:- type bool ---> yes ; no.
:- pred bool__or(bool, bool, bool).
:- mode bool__or(in, in, out) is det.
:- pred bool__or_list(list(bool), bool).
:- mode bool__or_list(in, out) is det.
:- pred bool__and(bool, bool, bool).
:- mode bool__and(in, in, out) is det.
:- pred bool__and_list(list(bool), bool).
:- mode bool__and_list(in, out) is det.
:- pred bool__not(bool, bool).
:- mode bool__not(in, out) is det.
%-----------------------------------------------------------------------------%
:- implementation.
bool__or(yes, _, yes).
bool__or(no, Bool, Bool).
bool__or_list([], no).
bool__or_list([Bool | Bools], Result) :-
( Bool = yes ->
Result = yes
;
bool__or_list(Bools, Result)
).
bool__and(no, _, no).
bool__and(yes, Bool, Bool).
bool__and_list([], yes).
bool__and_list([Bool | Bools], Result) :-
( Bool = no ->
Result = no
;
bool__and_list(Bools, Result)
).
bool__not(no, yes).
bool__not(yes, no).
%-----------------------------------------------------------------------------%