The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Muldis::D::Ext::Tuple - Muldis D extension adding more generic tuple operators

VERSION

This document is Muldis::D::Ext::Tuple version 0.97.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 Tuple document describes the system-defined Muldis D Tuple Extension, which consists of extra operators for generic tuples, 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.

SYSTEM-DEFINED GENERIC TUPLE-CONCERNING FUNCTIONS

These functions are applicable to mainly tuple types, but are generic in that they typically work with any tuple types.

sys.std.Tuple.d0

function sys.std.Tuple.d0 (Tuple <--)

This named-value selector function results in the only zero-attribute Tuple value, which is known by the special name Tuple:d0, aka d0.

sys.std.Tuple.degree

function sys.std.Tuple.degree (NNInt <-- $topic : Tuple)

This function results in the degree of its argument (that is, the count of attributes it has).

sys.std.Tuple.is_nullary

function sys.std.Tuple.is_nullary (Bool <-- $topic : Tuple)

This function results in Bool:true iff its argument has a degree of zero (that is, it has zero attributes), and Bool:false otherwise. By definition, the only 1 tuple value for which this function would result in Bool:true is the value Tuple:d0.

sys.std.Tuple.is_not_nullary

function sys.std.Tuple.is_not_nullary (Bool <-- $topic : Tuple)

This function is exactly the same as sys.std.Tuple.is_nullary except that it results in the opposite boolean value when given the same argument.

sys.std.Tuple.has_attrs

function sys.std.Tuple.has_attrs (Bool <-- $topic : Tuple, $attr_names : set_of.Name)

This function results in Bool:true iff, for every one of the attribute names specified by its attr_names argument, its topic argument has an attribute with that name; otherwise it results in Bool:false. As a trivial case, this function's result is Bool:true if attr_names is empty.

sys.std.Tuple.attr_names

function sys.std.Tuple.attr_names (set_of.Name <-- $topic : Tuple)

This function results in the set of the names of the attributes of its argument.

sys.std.Tuple.attr_from_Tuple

function sys.std.Tuple.attr_from_Tuple (Universal <-- $topic : Tuple)

This function results in the scalar or nonscalar value of the sole attribute of its argument. This function will fail if its argument is not of degree 1.

sys.std.Tuple.Tuple_from_attr

function sys.std.Tuple.Tuple_from_attr (Tuple <-- $name : Name, $value : Universal)

This function results in the Tuple value which has just one attribute whose name is given by name and whose value is given by value.

sys.std.Tuple.order_by_attr_names

function sys.std.Tuple.order_by_attr_names (Order <-- $topic : Tuple, $other : Tuple, $order_by : array_of.OrderByName, $is_reverse_order? : Bool)

This order-determination function provides convenient short-hand for the common case of ordering tuples of a relation on a sequential list of its named attributes, and the type of each of those attributes is a subtype of a single scalar root type having a non-customizable (using misc_args) type-default order-determination function, which is used to order on that attribute. This function is a short-hand for invoking sys.std.Core.Cat.Order.reduction on an Array each of whose Order elements is the result of invoking sys.std.Core.Scalar.order on the corresponding attributes of topic and other whose names are given in order_by; the Array given to Order.reduction has the same number of elements as order_by has. For each element value in order_by, the name attribute specifies the attribute name of each of topic and other to be compared, and the comparison operator's is_reverse_order argument is supplied by the is_reverse_order attribute. This function will fail if topic and other don't have an identical degree and attribute names, or if order_by specifies any attribute names that topic|other doesn't have, or if for any attribute named to be ordered by, that attribute's value for either of topic and other isn't a member of a scalar root type having a type-default ordering function, or if said root type isn't identical for both topic and other. The order_by_attr_names function's is_reverse_order argument is optional and defaults to Bool:false, meaning it has no further effect on the function's behaviour; but if this argument is Bool:true, then this function will result in the opposite Order value that it otherwise would have when given all the same other argument values. It is expected that for any relation whose tuples are to be ordered using order_by_attr_names, the order_by constitutes a key or superkey.

sys.std.Tuple.subst_in_default

function sys.std.Tuple.subst_in_default (Tuple <-- $of : TypeRef, $subst : Tuple)

This function results in the tuple value that is the default value of the tuple data type whose name is given in the of argument, but that zero or more of its attribute values have been substituted by values given in the subst argument. This function is a short-hand for sys.std.Core.Tuple.multi_update on the result of sys.std.Core.Universal.default. This function will fail if either default would fail for the same of argument, or if its result isn't a tuple type, or if the heading of subst isn't a subset of the heading of the default. The purpose of this function is to support greater brevity in Muldis D coding such that users can define just part of a desired tuple value and have the remainder filled in from defaults for them; particularly useful with tuples that conceptually have some optional attributes.

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.