NAME
Muldis::D::Ext::QArray - Muldis D extension for QArray specific operators
VERSION
This document is Muldis::D::Ext::QArray version 0.59.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 QArray document describes the system-defined Muldis D QArray Extension, which consists of generic operators that are specific to the QArray parameterized q/relation type, and said operators are short-hands for generic relational operators 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.
SYSTEM-DEFINED QUASI-/ARRAY-CONCERNING FUNCTIONS
Each \w*assuming parameter is optional and defaults to the zero-attribute tuple if no explicit argument is given to it.
function sys.std.QArray.value result Universal params { topic(QArray), index(NNInt) }-
This function results in the q/scalar or q/nonscalar
valueattribute of the q/tuple oftopicwhoseindexattribute isindex. This function will fail if no q/tuple exists intopicwith the specified index. function sys.std.QArray.update_value result QArray params { topic(QArray), index(NNInt), value(Universal) }-
This function results in its
topicargument but that thevalueattribute of the q/tuple oftopicwhoseindexattribute isindexhas been updated with a new q/scalar or q/nonscalar value given byvalue. This function will fail if no q/tuple exists intopicwith the specified index. This function will warn if the most specific types of thevalueargument and thevalueattribute oftopicare incompatible as peris_identical, or otherwise if the declared type ofvalueisn't a subtype of the declared type of thevalueattribute. function sys.std.QArray.insertion result QArray params { topic(QArray), index(NNInt), value(Universal) }-
This function results in its
topicargument but that a new q/tuple has been inserted whoseindexisindexand whosevalueisvalue; any existing q/tuples withindexvalues greater than or equal toindexhad theirs incremented by 1. As a trivial case, ifindexis equal to zero or is equal to the cardinality oftopic, thenvaluehas become the new first or last (or only) element, respectively. This function will fail ifindexis greater than the cardinality oftopic, or it will warn iftopic.valueandvalueare incompatible as perupdate_value. function sys.std.QArray.deletion result QArray params { topic(QArray), index(NNInt) }-
This function results in its
topicargument but that a q/tuple has been deleted whoseindexisindex; any existing q/tuples withindexvalues greater than or equal toindexhad theirs decremented by 1. This function will fail if no q/tuple exists intopicwith the specified index. function sys.std.QArray.is_element result Bool params { topic(QArray), value(Universal) }-
This function results in
Bool:trueiff itsvalueargument matches thevalueattribute of at least one q/tuple of itstopicargument (that is, iff conceptuallyvalueis an element oftopic), andBool:falseotherwise. This function will warn iftopic.valueandvalueare incompatible as perupdate_value. function sys.std.QArray.is_not_element result Bool params { topic(QArray), value(Universal) }-
This function is exactly the same as
sys.std.QArray.is_elementexcept that it results in the opposite boolean value when given the same arguments. function sys.std.QArray.reduction result Universal params { topic(QArray), func(FuncRef), assuming(QTuple)?, identity(Universal) }-
This function is the same as
sys.std.QSet.reduction, including that input values for the reduction come from thevalueattribute oftopic, except that it works with anQArrayrather than aQSet. Also, the function named infuncis only associative, and not commutative; the arguments tov1andv2offuncare guaranteed to be consecutive input elements, with the result returning to their place in sequence beween the other input elements. function sys.std.QArray.maybe_reduction result QMaybe params { topic(QArray), func(FuncRef), assuming(QTuple)? }-
This function is to
sys.std.QSet.maybe_reductionassys.std.QArray.reductionis tosys.std.QSet.reduction. function sys.std.QArray.slice result QArray params { topic(QArray), first_index(NNInt), last_index(NNInt) }-
This function results in the sub-sequence of its
topicargument that is specified by itsfirst_indexandlast_indexarguments, which specify the inclusive source-indexrange of the elements of the result. This function will fail iflast_indexis beforefirst_index. It is valid forfirst_indexorlast_indexto be greater than the last index oftopic; in the first case, the result has zero elements; in the second case, the result has all remaining elements starting atfirst_index. Iftopichas any elements andfirst_indexmatches the index of a source element, then the result will always have at least 1 element. function sys.std.QArray.catenation result QArray params { topic(quasi_array_of.QArray) }-
This function results in the catenation of the N element values of its argument; it is a reduction operator that recursively takes each consecutive pair of input values and catenates (which is associative) them together until just one is left, which is the result. To catenate 2
QArraymeans to union their q/tuples after first increasing all theindexvalues of the second one by the cardinality of the first one. Iftopichas zero values, thencatenateresults in the empty sequence value, which is the identity value for catenate. function sys.std.QArray.repeat result QArray params { topic(QArray), count(NNInt) }-
This function results in the catenation of
countinstances oftopic. function sys.std.QArray.reverse result QArray params { topic(QArray) }-
This function results in its argument but that the order of its elements has been reversed. For example, the input
{ 0=>'a', 1=>'b', 2=>'c', 3=>'d'}results in{ 0=>'d', 1=>'c', 2=>'b', 3=>'a' }. function sys.std.QArray.is_subarray result Bool params { look_in(QArray), look_for(QArray) }-
This function results in
Bool:trueiff the sequence of values comprisinglook_foris a sub-sequence of the sequence of valueslook_in, andBool:falseotherwise. This function will fail|warn if the 2 arguments don't have a compatible or same heading. function sys.std.QArray.is_not_subarray result Bool params { look_in(QArray), look_for(QArray) }-
This function is exactly the same as
sys.std.QArray.is_subarrayexcept that it results in the opposite boolean value when given the same arguments. function sys.std.QArray.QArray_from_wrap result quasi_array_of.QTuple params { topic(QRelation), ord_func(FuncRef), ord_assuming(QTuple)? }-
This function results in an
QArraywhosevalueattribute is q/tuple-typed and that attribute's values are all the q/tuples oftopic; is a short-hand for a relational wrap of all attributes oftopicsuch that the new q/tuple-valued attribute is namedvalue, and then that result is extended with anindexattribute whose values result from a rank of the q/tuples, where the ranked-first q/tuple has anindexof zero, and so on. This function is a wrapper over the (total)order_determinationfunction named in itsord_funcargument when the latter function is curried by itsord_assumingargument; this wrapped function is used to rank the q/tuples, with each invocation getting atopicq/tuple as each itstopicandotherarguments. See also thesys.std.QRelation.rankfunction, which is the same assys.std.QArray.QArray_from_wrapbut that it just adds an attribute to the source q/tuples and does not wrap them. function sys.std.QArray.limit_of_QArray_from_wrap result quasi_array_of.QTuple params { topic(QRelation), ord_func(FuncRef), ord_assuming(QTuple)?, first_index(NNInt), last_index(NNInt) }-
This function is a short-hand for invoking first
sys.std.QArray.QArray_from_wrapand thensys.std.QArray.sliceon its result. This function is tosys.std.QArray.QArray_from_wrapwhat thesys.std.QRelation.limitfunction is tosys.std.QRelation.rank. function sys.std.QArray.QArray_from_attr result QArray params { topic(QRelation), name(Name), ord_func(OrdDetFuncRef)?, ord_assuming(QTuple)? }-
This function results in an
QArrayconsisting of all the values of the attribute oftopicnamed byname. It is a short-hand for a unary projection of just the named attribute plus its renaming tovalue, and then that result is extended with anindexattribute whose values result from a rank of the source attribute values, where the ranked-first source value has anindexof zero, and so on. This function is otherwise the same assys.std.QArray.QArray_from_wrap. Each of theord_funcandord_assumingparameters is optional and defaults tosys.std.Core.QScalar.orderor the zero-attribute tuple, respectively, if no explicit argument is given to it.
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.