NAME
Muldis::D::Ext::Ordered - Muldis D extension for generic ordered-sensitive operators
VERSION
This document is Muldis::D::Ext::Ordered version 0.26.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 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 has a (total) order_determination function defined for it, and all system-defined conceptually-ordered Muldis D scalar root types do.
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.
SYSTEM-DEFINED ORDER-CONCERNING FUNCTIONS
Each of these functions which has the 2 parameters named func and assuming is a wrapper over the order_determination function named in its func argument when the latter function is curried by its assuming argument. For any scalar root type's type-default order function, the argument for func is sys.std.Core.Scalar.order. Each func and assuming parameter is optional and defaults to sys.std.Core.Scalar.order or the zero-attribute tuple, respectively, if no explicit argument is given to it.
function sys.std.Ordered.reverse_order result Cat.Order params { topic(Universal), other(Universal), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is exactly the same as the
order_determinationfunction it wraps except that it results in the reverse value when given the same non-funcarguments. It is a short-hand for applyingsys.std.Core.Cat.Order_reverseto the result of the wrapped function with the same non-funcarguments. function sys.std.Ordered.is_before result Bool params { topic(Universal), other(Universal), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function results in
Bool:trueiff the wrapped function would result inCat.Order:increasewhen given the same arguments, andBool:falseotherwise. function sys.std.Ordered.is_not_before result Bool params { topic(Universal), other(Universal), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is exactly the same as
sys.std.Ordered.is_beforeexcept 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.std.Ordered.is_inside_range result Bool params { topic(Universal), min(Universal), max(Universal), min_is_outside(Bool)?, max_is_outside(Bool)?, func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function results in
Bool:trueiff itstopicargument is within the range whose bounds are defined by itsminandmaxarguments. Ifmin_is_outsideormax_is_outsideareBool:true, thentopicis not considered to be within the range if it is equal tominormax, respectively; otherwise,topicis considered to be within the range if it is equal tominormax. This function'sminandmaxarguments must be of compatible declared types withtopicandorderas per the wrapped function; otherwise this function will fail|warn when the wrapped function would. This function will fail ifmaxis beforemin. Each of them(in|ax)_is_outsideparameters is optional and defaults toBool:falseif no explicit argument is given to it. function sys.std.Ordered.is_outside_range result Bool params { topic(Universal), min(Universal), max(Universal), min_is_outside(Bool)?, max_is_outside(Bool)?, func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is exactly the same as
sys.std.Ordered.is_inside_rangeexcept that it results in the opposite boolean value when given the same arguments. function sys.std.Ordered.min result Universal params { topic(Set), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
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
topichas zero values, then this function will fail. Note that, conceptuallymindoes have an identity value which could be this function's result whentopichas zero values, which is the result type's concept of positive infinity; however, in practice there is little benefit tominsupporting this identity value, since the wrappedorder_determinationfunction can't supply the value, and also many types' concept of positive infinity is impossible or impractically large to represent, such as with the infiniteTexttype. function sys.std.Ordered.max result Universal params { topic(Set), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is exactly the same as
sys.std.Ordered.minexcept that it results in the maximum input element value rather than the minimum one. (Note that, conceptuallymaxhas an identity value which is the result type's concept of negative infinity, but it is unsupported here). function sys.std.Ordered.maybe_min result Maybe params { topic(Set), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is exactly the same as
sys.std.Ordered.minexcept that it results in aMaybeof what is otherwise the result type, and that result has zero elements if the argument has zero elements, rather than the function failing. function sys.std.Ordered.maybe_max result Maybe params { topic(Set), func(Cat.OrdDetFuncRef)?, assuming(QuasiTuple)? }-
This function is to
sys.std.Ordered.maxassys.std.Ordered.maybe_minis tosys.std.Ordered.min.
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-2008, Darren Duncan.
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.