=pod =encoding utf8 =head1 NAME Muldis::D::Core::Array - Muldis D Array specific operators =head1 VERSION This document is Muldis::D::Core::Array version 0.148.0. =head1 PREFACE This document is part of the Muldis D language specification, whose root document is L; you should read that root document before you read this one, which provides subservient details. Moreover, you should read the L document before this current document, as that forms its own tree beneath a root document branch. =head1 DESCRIPTION This document describes generic operators that are specific to the C parameterized relation type, and said operators are short-hands for more generic relational operators. I =head1 FUNCTIONS IMPLEMENTING VIRTUAL STRINGY FUNCTIONS =head2 sys.std.Core.Array.catenation C<< function catenation (Array <-- topic? : array_of.Array) implements sys.std.Core.Stringy.catenation {...} >> 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 C means to union their tuples after first increasing all the C values of the second one by the cardinality of the first one. If C has zero values, then C results in the empty sequence value, which is the identity value for catenation. =head2 sys.std.Core.Array.replication C<< function replication (Array <-- topic : Array, count : NNInt) implements sys.std.Core.Stringy.replication {...} >> This function results in the catenation of C instances of C. =head1 FUNCTIONS IMPLEMENTING VIRTUAL COLLECTIVE FUNCTIONS =head2 sys.std.Core.Array.has_elem C<< function has_elem (Bool <-- coll : Array, value : Universal) implements sys.std.Core.Collective.has_member {...} >> This function results in C iff its C argument matches the C attribute of at least one tuple of its C argument (that is, iff conceptually C is an element of C), and C otherwise. This function will warn if C and C are incompatible as per C. =head2 sys.std.Core.Array.has_not_elem C<< function has_not_elem (Bool <-- coll : Array, value : Universal) implements sys.std.Core.Collective.has_not_member {...} >> This function is exactly the same as C except that it results in the opposite boolean value when given the same arguments. =head2 sys.std.Core.Array.value_is_elem C<< function value_is_elem (Bool <-- value : Universal, coll : Array) implements sys.std.Core.Collective.value_is_member {...} >> This function is an alias for C. This function results in C iff its C argument matches the C attribute of at least one tuple of its C argument (that is, iff conceptually C is an element of C), and C otherwise. =head2 sys.std.Core.Array.value_is_not_elem C<< function value_is_not_elem (Bool <-- value : Universal, coll : Array) implements sys.std.Core.Collective.value_is_not_member {...} >> This function is an alias for C. This function is exactly the same as C except that it results in the opposite boolean value when given the same arguments. =head1 GENERIC RELATIONAL FUNCTIONS FOR ARRAYS =head2 sys.std.Core.Array.value C<< function value (Universal <-- topic : Array, index : NNInt) {...} >> This function results in the scalar or nonscalar C attribute of the tuple of C whose C attribute is C. This function will fail if no tuple exists in C with the specified index. Note that this operation is also known as C<.[]>. =head2 sys.std.Core.Array.update_value C<< function update_value (Array <-- topic : Array, index : NNInt, value : Universal) {...} >> This function results in its C argument but that the C attribute of the tuple of C whose C attribute is C has been updated with a new scalar or nonscalar value given by C. This function will fail if no tuple exists in C with the specified index. This function will warn if the most specific types of the C argument and the C attribute of C are incompatible as per C, or otherwise if the declared type of C isn't a subtype of the declared type of the C attribute. =head2 sys.std.Core.Array.insertion C<< function insertion (Array <-- topic : Array, index : NNInt, value : Universal) {...} >> This function results in its C argument but that a new tuple has been inserted whose C is C and whose C is C; any existing tuples with C values greater than or equal to C had theirs incremented by 1. As a trivial case, if C is equal to zero or is equal to the cardinality of C, then C has become the new first or last (or only) element, respectively. This function will fail if C is greater than the cardinality of C, or it will warn if C and C are incompatible as per C. =head2 sys.std.Core.Array.deletion C<< function deletion (Array <-- topic : Array, index : NNInt) {...} >> This function results in its C argument but that a tuple has been deleted whose C is C; any existing tuples with C values greater than or equal to C had theirs decremented by 1. This function will fail if no tuple exists in C with the specified index. =head2 sys.std.Core.Array.reduction C<< function reduction (Universal <-- topic : Array, func : ValRedCFuncNC, identity : Universal) {...} >> This function is the same as C, including that input values for the reduction come from the C attribute of C, except that it works with an C rather than a C. Also, the C function named in C is only associative, and I commutative; the arguments to C and C of C are guaranteed to be consecutive input elements, with the result returning to their place in sequence beween the other input elements. =head2 sys.std.Core.Array.slice C<< function slice (Array <-- topic : Array, index_interval : sp_interval_of.NNInt) {...} >> This function results in the sub-sequence of its C argument that is specified by its C argument, which specifies the source-C interval of the elements of the result. It is valid for the lowest and highest source-C specified by C to be greater than the last index of C; in the first case, the result has zero elements; in the second case, the result has all remaining elements starting at the lowest source-C, if any. Note that this operation is also known as C<[]>. =head2 sys.std.Core.Array.reverse C<< function reverse (Array <-- topic : Array) {...} >> This function results in its argument but that the order of its elements has been reversed. For example, the input C<< { 0=>'a', 1=>'b', 2=>'c', 3=>'d'} >> results in C<< { 0=>'d', 1=>'c', 2=>'b', 3=>'a' } >>. =head2 sys.std.Core.Array.has_subarray C<< function has_subarray (Bool <-- look_in : Array, look_for : Array) {...} >> This function results in C iff the sequence of values comprising C is a sub-sequence of the sequence of values C, and C otherwise. This function will fail|warn if the 2 arguments don't have a compatible or same heading. =head2 sys.std.Core.Array.has_not_subarray C<< function has_not_subarray (Bool <-- look_in : Array, look_for : Array) {...} >> This function is exactly the same as C except that it results in the opposite boolean value when given the same arguments. =head2 sys.std.Core.Array.order C<< function order (Order <-- topic : Array, other : Array, elem_ord_func? : OrdDetCFuncNC, elem_is_reverse_order? : Bool, is_reverse_order? : Bool) {...} >> This function is a generic (total) C function for C values, especially for homogeneous ones. Iff both of its C and C arguments are identical, this function results in C. Otherwise, iff one of those 2 arguments is a subarray of the other where the latter is matched by its leading elements, meaning that the former's tuples are a proper subset of the latter's, then the shorter argument is ordered before the longer one. Otherwise, the order of the C and C arguments is determined by the comparison of the lowest-index distinct element values of those arguments, as follows: The result of this function is the result of applying to those 2 elements the (total) C function given in its C argument, as curried by its C argument. Iff C is ordered before C, this function results in C; otherwise, iff C is ordered before C, this function results in C. The C argument is applied to the result of this function I all of the other arguments are applied; if it is C, it does not change the result; if it is C, then it reverses the result. =head2 sys.std.Core.Array.Array_from_wrap C<< function Array_from_wrap (array_of.Tuple <-- topic : Relation, ord_func : OrdDetCFuncNC, is_reverse_order? : Bool) {...} >> This function results in an C whose C attribute is tuple-typed and that attribute's values are all the tuples of C; is a short-hand for a relational wrap of all attributes of C such that the new tuple-valued attribute is named C, and then that result is extended with an C attribute whose values result from a rank of the tuples, where the ranked-first tuple has an C of zero, and so on. This function is a wrapper over the (total) C function named in its C argument when the latter function is curried by its C argument; this wrapped function is used to rank the tuples, with each invocation getting a C tuple as each its C and C arguments. See also the C function, which is the same as C but that it just adds an attribute to the source tuples and does not wrap them. =head2 sys.std.Core.Array.Array_from_wrap_by_attr_names C<< function Array_from_wrap_by_attr_names (array_of.Tuple <-- topic : Relation, order_by : array_of.OrderByName, is_reverse_order? : Bool) {...} >> This function is to C what C is to C. Note that this function is the most direct analogy to the common case of SQL's "ORDER BY" where a simple list of attribute names is given to sort on (and the tuples remain sorted), which is in contrast with C that is the analogy to the general case of "ORDER BY" that may contain any arbitrary value expression. =head2 sys.std.Core.Array.limit_of_Array_from_wrap C<< function limit_of_Array_from_wrap (array_of.Tuple <-- topic : Relation, ord_func : OrdDetCFuncNC, is_reverse_order? : Bool, index_interval : sp_interval_of.NNInt) {...} >> This function is a short-hand for invoking first C and then C on its result. This function is to C what the C function is to C. =head2 sys.std.Core.Array.limit_of_Array_from_wrap_by_attr_names C<< function limit_of_Array_from_wrap_by_attr_names (array_of.Tuple <-- topic : Relation, order_by : array_of.OrderByName, is_reverse_order? : Bool, index_interval : sp_interval_of.NNInt) {...} >> This function is to C what C is to C. =head2 sys.std.Core.Array.Array_from_attr C<< function Array_from_attr (Array <-- topic : Relation, name : Name, ord_func? : OrdDetCFuncNC, is_reverse_order? : Bool) {...} >> This function results in an C consisting of all the values of the attribute of C named by C. It is a short-hand for a unary projection of just the named attribute plus its renaming to C, and then that result is extended with an C attribute whose values result from a rank of the source attribute values, where the ranked-first source value has an C of zero, and so on. This function is otherwise the same as C. Each of the C and C parameters is optional and defaults to C or C, respectively, if no explicit argument is given to it. =head2 sys.std.Core.Array.Array_from_Set C<< function Array_from_Set (Array <-- topic : Set, ord_func? : OrdDetCFuncNC, is_reverse_order? : Bool) {...} >> This function results in an C consisting of all the values of C. It is a short-hand for a C invocation with a C argument of C, and C is a C. =head1 SEE ALSO Go to L for the majority of distribution-internal references, and L for the majority of distribution-external references. =head1 AUTHOR Darren Duncan (C) =head1 LICENSE AND COPYRIGHT This file is part of the formal specification of the Muldis D language. Muldis D is Copyright © 2002-2011, Muldis Data Systems, Inc. See the LICENSE AND COPYRIGHT of L for details. =head1 TRADEMARK POLICY The TRADEMARK POLICY in L applies to this file too. =head1 ACKNOWLEDGEMENTS The ACKNOWLEDGEMENTS in L apply to this file too. =cut