NAME
Language::MuldisD::Ext::Ordered - Muldis D extension for generic ordered-sensitive operators
VERSION
This document is Language::MuldisD::Ext::Ordered version 0.20.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Language::MuldisD; 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 Ordered
document describes the system-defined Muldis D Ordered Extension, which consists of generic operators that are sensitive to an ordering of a type's values, and are used for such things as list sorting or quota queries or determining before/after/min/max/between/etc. They can potentially be used with values of any data type as long as said data type is either inherently ordered or or has an order-determination operator defined for them.
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 Language::MuldisD::Core.
This documentation is pending.
SYSTEM-DEFINED ORDER-CONCERNING FUNCTIONS
These functions are applicable to values of potentially any data type, those which have a comparison
or such function defined for them. They provide a common syntax for sort-related functionality, though technically every type having these functions is re-implementing its own version. If values of an ordered data type can conceivably be sorted using multiple criteria (such as different text collations), then these functions just represent the default criteria; any additional criteria are represented by additional functions declared for just the types they apply to.
function sys.Ordered.Ord.is_before result Bool params { topic(Universal), other(Universal) }
-
This function results in
Bool:true
iff its 2 arguments are non-identical and the value of thetopic
argument is considered to come before the value of theother
argument when the 2 values are arranged in order (as defined by the type); it results inBool:false
otherwise. This function's arguments must be of compatible declared types; in this case, 2 declared types are compatible iff they are both subtypes of a common scalar type that declares acomparison
function for itself. Note thatis_before
is considered the only fundamental ordered-specific operator, and all others are defined over it plusis_identical
. function sys.Ordered.Ord.is_not_before result Bool params { topic(Universal), other(Universal) }
-
This function is exactly the same as
sys.Ordered.Ord.is_before
except that it results in the opposite boolean value when given the same arguments. (It could alternately be called "is after or is identical".) function sys.Ordered.Ord.is_inside_range result Bool params { topic(Universal), min(Universal), max(Universal), min_is_inside(Bool), max_is_inside(Bool) }
-
This function results in
Bool:true
iff itstopic
argument is within the range whose bounds are defined by itsmin
andmax
arguments. Ifmin_is_inside
ormax_is_inside
areBool:true
, thentopic
is considered to be within the range if it is equal tomin
ormax
, respectively. This function's arguments must be of compatible declared types as persys.Ordered.Ord.is_before
. This function will fail ifmax
is beforemin
. function sys.Ordered.Ord.is_outside_range result Bool params { topic(Universal), min(Universal), max(Universal), min_is_inside(Bool), max_is_inside(Bool) }
-
This function is exactly the same as
sys.Ordered.Ord.is_inside_range
except that it results in the opposite boolean value when given the same arguments. function sys.Ordered.Ord.min result Universal params { topic(Set) }
-
This function is a reduction operator that recursively takes each pair of its N input element values and picks the minimum of the 2 (a process which is both commutative and associative) until just one is left, which is the function's result. If
topic
has zero values, thenmin
results in the result type's concept of positive infinity, which is the identity value for min. This function will fail on atopic
of zero values if the result type's concept of positive infinity is impossible or impractically large to represent, such as with the infiniteText
type. function sys.Ordered.Ord.max result Universal params { topic(Set) }
-
This function is exactly the same as
sys.Ordered.Ord.min
except that it results in the maximum input element value rather than the minimum one, and its identity value is the result type's concept of negative infinity. function sys.Ordered.Ord.maybe_min result Maybe params { topic(Set) }
-
This function is exactly the same as
sys.Ordered.Ord.min
except that it results in aMaybe
of what is otherwise the result type, and that result has zero elements if the argument has zero elements. function sys.Ordered.Ord.maybe_max result Maybe params { topic(Set) }
-
This function is to
sys.Ordered.Ord.max
assys.Ordered.Ord.maybe_min
is tosys.Ordered.Ord.min
.
SEE ALSO
Go to Language::MuldisD for the majority of distribution-internal references, and Language::MuldisD::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-2008, Darren Duncan.
See the LICENSE AND COPYRIGHT of Language::MuldisD for details.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Language::MuldisD apply to this file too.