NAME
Muldis::D::Ext::Bool - Muldis D extension adding more boolean logic operators
VERSION
This document is Muldis::D::Ext::Bool version 0.85.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Muldis::D; you should read that root document before you read this one, which provides subservient details.
DESCRIPTION
Muldis D has a mandatory core set of system-defined (eternally available) entities, which is referred to as the Muldis D core or the core; they are the minimal entities that all Muldis D implementations need to provide; they are mutually self-describing and are used to bootstrap the language; any entities outside the core, called Muldis D extensions, are non-mandatory and are defined in terms of the core or each other, but the reverse isn't true.
This current Bool
document describes the system-defined Muldis D Bool Extension, which consists of extra operators for boolean logic, adding to the minimum few defined in the language core.
This current document does not describe the polymorphic operators that all types, or some types including core types, have defined over them; said operators are defined once for all types in Muldis::D::Core.
This documentation is pending.
FUNCTIONS FOR BOOLEAN LOGIC
These functions implement all of the boolean logic specific operations that aren't implemented by the Muldis D language core ("SYSTEM-DEFINED BOOLEAN-CONCERNING FUNCTIONS" in Muldis::D::Core::Routines, "SYSTEM-DEFINED GENERIC UNIVERSAL FUNCTIONS" in Muldis::D::Core::Routines, "sys.std.Core.Type.Bool" in Muldis::D::Core::Types), plus some aliases for ones that are.
sys.std.Bool.nand
function sys.std.Bool.nand (Bool <-- Bool $topic, Bool $other)
This symmetric function results in Bool:false
iff its 2 arguments are both Bool:true
, and Bool:true
otherwise. Note that this operation is also known as not and or not both or alternative denial or ⊼
or ↑
.
sys.std.Bool.nor
function sys.std.Bool.nor (Bool <-- Bool $topic, Bool $other)
This symmetric function results in Bool:true
iff its 2 arguments are both Bool:false
, and Bool:false
otherwise. Note that this operation is also known as not or or neither ... nor or joint denial or ⊽
or ↓
.
sys.std.Bool.xnor
function sys.std.Bool.xnor (Bool <-- bag_of.Bool $topic?)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical xnor (which is both commutative and associative) on them until just one is left, which is the function's result. For each pair of input values, the xnor of that pair is Bool:true
iff both input values are exactly the same value, and Bool:false
otherwise. If topic
has zero values, then xnor
results in Bool:true
, which is the identity value for logical xnor. Note that this operation is also known as not xor or iff (if and only if) or material equivalence or biconditional or equivalent (dyadic usage) or even parity or ↔
. Note that a dyadic (2 input value) invocation of xnor
is exactly the same operation as a sys.std.Core.Universal.is_identical
invocation whose arguments are both Bool
-typed.
sys.std.Bool.iff
function sys.std.Bool.iff (Bool <-- bag_of.Bool $topic?)
This function is an alias for sys.std.Bool.xnor
.
sys.std.Bool.xor
function sys.std.Bool.xor (Bool <-- bag_of.Bool $topic?)
This function is a reduction operator that recursively takes each pair of its N input element values and does a logical exclusive-or (which is both commutative and associative) on them until just one is left, which is the function's result. For each pair of input values, the xor of that pair is Bool:false
iff both input values are exactly the same value, and Bool:true
otherwise. If topic
has zero values, then xor
results in Bool:false
, which is the identity value for logical exclusive-or. Note that this operation is also known as exclusive disjunction or not equivalent (dyadic usage) or odd parity or ⊻
or ↮
. Note that a dyadic (2 input value) invocation of xor
is exactly the same operation as a sys.std.Core.Universal.is_not_identical
invocation whose arguments are both Bool
-typed.
sys.std.Bool.imp
function sys.std.Bool.imp (Bool <-- Bool $topic, Bool $other)
This function results in Bool:false
iff its topic
argument is Bool:true
and its other
argument is Bool:false
, and Bool:true
otherwise. Note that this operation is also known as implies or material implication or →
.
sys.std.Bool.implies
function sys.std.Bool.implies (Bool <-- Bool $topic, Bool $other)
This function is an alias for sys.std.Bool.imp
.
sys.std.Bool.nimp
function sys.std.Bool.nimp (Bool <-- Bool $topic, Bool $other)
This function is exactly the same as sys.std.Bool.imp
except that it results in the opposite boolean value when given the same arguments. Note that this operation is also known as not implies or material nonimplication or ↛
.
sys.std.Bool.if
function sys.std.Bool.if (Bool <-- Bool $topic, Bool $other)
This function is an alias for sys.std.Bool.imp
except that it transposes the topic
and other
arguments. This function results in Bool:false
iff its topic
argument is Bool:false
and its other
argument is Bool:true
, and Bool:true
otherwise. Note that this operation is also known as converse implication or reverse material implication or ←
.
sys.std.Bool.nif
function sys.std.Bool.nif (Bool <-- Bool $topic, Bool $other)
This function is exactly the same as sys.std.Bool.if
except that it results in the opposite boolean value when given the same arguments. Note that this operation is also known as not if or converse nonimplication or ↚
.
sys.std.Bool.not_all
function sys.std.Bool.not_all (Bool <-- set_of.Bool $topic?)
This function is exactly the same as sys.std.Core.Bool.all
except that it results in the opposite boolean value when given the same argument. This function results in Bool:true
iff not all of its input element values are Bool:true
, and Bool:false
otherwise (when all of its input values are Bool:true
or if it has no input values).
sys.std.Bool.none
function sys.std.Bool.none (Bool <-- set_of.Bool $topic?)
This function is exactly the same as sys.std.Core.Bool.any
except that it results in the opposite boolean value when given the same argument. This function results in Bool:true
iff none of its input element values are Bool:true
(or it has no input values), and Bool:false
otherwise (when it has at least one input value that is Bool:true
). Note that this operation is also known as not any.
sys.std.Bool.not_any
function sys.std.Bool.not_any (Bool <-- set_of.Bool $topic?)
This function is an alias for sys.std.Bool.none
.
sys.std.Bool.one
function sys.std.Bool.one (Bool <-- bag_of.Bool $topic?)
This function results in Bool:true
iff exactly one of its input element values is Bool:true
, and Bool:false
otherwise. Note that in some contexts, this operation would alternately be known as xor, but in Muldis D it is not.
sys.std.Bool.not_one
function sys.std.Bool.not_one (Bool <-- bag_of.Bool $topic?)
This function is exactly the same as sys.std.Bool.one
except that it results in the opposite boolean value when given the same argument.
sys.std.Bool.exactly
function sys.std.Bool.exactly (Bool <-- bag_of.Bool $topic?, NNInt $count)
This function results in Bool:true
iff the count of its input element values that are Bool:true
matches the count
argument, and Bool:false
otherwise.
sys.std.Bool.not_exactly
function sys.std.Bool.not_exactly (Bool <-- bag_of.Bool $topic?, NNInt $count)
This function is exactly the same as sys.std.Bool.exactly
except that it results in the opposite boolean value when given the same argument.
sys.std.Bool.true
function sys.std.Bool.true (NNInt <-- bag_of.Bool $topic?)
This function results in the count of its input element values that are Bool:true
.
sys.std.Bool.false
function sys.std.Bool.false (NNInt <-- bag_of.Bool $topic?)
This function results in the count of its input element values that are Bool:false
.
SEE ALSO
Go to Muldis::D for the majority of distribution-internal references, and Muldis::D::SeeAlso for the majority of distribution-external references.
AUTHOR
Darren Duncan (perl@DarrenDuncan.net
)
LICENSE AND COPYRIGHT
This file is part of the formal specification of the Muldis D language.
Muldis D is Copyright © 2002-2009, Muldis Data Systems, Inc.
See the LICENSE AND COPYRIGHT of Muldis::D for details.
TRADEMARK POLICY
The TRADEMARK POLICY in Muldis::D applies to this file too.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Muldis::D apply to this file too.