NAME

Muldis::D::Ext::QSet - Muldis D extension for QSet and QMaybe specific operators

VERSION

This document is Muldis::D::Ext::QSet version 0.71.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 QSet document describes the system-defined Muldis D QSet Extension, which consists of generic operators that are specific to the QSet and QMaybe parameterized q/relation types, 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-/SET-CONCERNING FUNCTIONS

Each assuming parameter is optional and defaults to the zero-attribute tuple if no explicit argument is given to it.

sys.std.QSet.is_member

function sys.std.QSet.is_member (Bool <-- QSet $set, Universal $value)

This function results in Bool:true iff its value argument matches the sole attribute of a q/tuple of its set argument (that is, iff conceptually value is a member of set), and Bool:false otherwise. This function will warn if its 2 arguments are incompatible as per sys.std.Core.QRelation.is_subset.

sys.std.QSet.is_not_member

function sys.std.QSet.is_not_member (Bool <-- QSet $set, Universal $value)

This function is exactly the same as sys.std.QSet.is_member except that it results in the opposite boolean value when given the same arguments.

sys.std.QSet.insertion

function sys.std.QSet.insertion (QSet <-- QSet $set, Universal $value)

This function results in a QSet that is the relational union of set and a QSet whose sole q/tuple has the sole attribute value of value; that is, conceptually the result is value inserted into set. As a trivial case, if value already exists in set, then the result is just set.

sys.std.QSet.disjoint_insertion

function sys.std.QSet.disjoint_insertion (QSet <-- QSet $set, Universal $value)

This function is exactly the same as sys.std.QSet.insertion except that it will fail if value already exists in set.

sys.std.QSet.deletion

function sys.std.QSet.deletion (QSet <-- QSet $set, Universal $value)

This function results in a QSet that is the relational difference from set of a QSet whose sole q/tuple has the sole attribute value of value; that is, conceptually the result is value deleted from set. As a trivial case, if value already doesn't exist in set, then the result is just set.

sys.std.QSet.reduction

function sys.std.QSet.reduction (Universal <-- QSet $topic, FuncRef $func, QTuple $assuming?, Universal $identity)

This function is a generic reduction operator that recursively takes each pair of input values in topic and applies an argument-specified q/scalar or q/nonscalar value-resulting function (which is both commutative and associative) to the pair until just one input value is left, which is the result. The function to apply is named in the func argument, and that function must have 3 arguments named v1, v2, assuming; the last parameter is curried with the same-named argument of reduction, and the first 2 parameters are the 2 input q/scalar or q/nonscalar values for an invocation. If topic has zero values, then reduction results in the value given in identity. Note that identity may be changed to take a function name rather than a value, for consistency with func. This function will fail|warn if the |declared type of identity isn't a subtype of the |declared type of the sole attribute of topic.

sys.std.QSet.maybe_reduction

function sys.std.QSet.maybe_reduction (QMaybe <-- QSet $topic, FuncRef $func, QTuple $assuming?)

This function is exactly the same as sys.std.QSet.reduction except that it does not take an identity argument, and it results in a QMaybe of what is otherwise the result type, and that result has zero elements if the argument has zero elements.

sys.std.QSet.QSet_from_wrap

function sys.std.QSet.QSet_from_wrap (set_of.QTuple <-- QRelation $topic)

This function results in a QSet whose sole attribute is q/tuple-typed and the attribute values are all the q/tuples of topic; is a short-hand for a relational wrap of all attributes of topic such that the new q/tuple-valued attribute is named value.

sys.std.QSet.QSet_from_attr

function sys.std.QSet.QSet_from_attr (QSet <-- QRelation $topic, Name $name)

This function results in a QSet consisting of all the values of the attribute of topic named by name. It is a short-hand for a unary projection of just the named attribute plus its renaming to value.

SYSTEM-DEFINED QUASI-/MAYBE-CONCERNING FUNCTIONS

sys.std.QSet.QMaybe.nothing

function sys.std.QSet.QMaybe.nothing (Maybe <--)

This selector function results in the only zero-tuple QMaybe value, which is known by the special name Maybe:nothing, aka nothing.

sys.std.QSet.QMaybe.single

function sys.std.QSet.QMaybe.single (QSingle <-- Universal $value)

This selector function results in the QMaybe value with a single q/tuple whose value attribute's value is the value argument.

sys.std.QSet.QMaybe.attr

function sys.std.QSet.QMaybe.attr (Universal <-- QSingle $topic)

This function results in the q/scalar or q/nonscalar value of the sole attribute of the sole q/tuple of its argument, which always exists when the argument is a QSingle.

sys.std.QSet.QMaybe.attr_or_default

function sys.std.QSet.QMaybe.attr_or_default (Universal <-- QMaybe $topic, TypeRef $default)

This function results in the q/scalar or q/nonscalar value of the sole attribute of the sole q/tuple of its argument, if said q/tuple exists; otherwise, it results in the default value of the q/scalar or q/nonscalar data type whose name is given in the default argument. This function is a short-hand for invoking attr_or_value with the result from invoking sys.std.Core.Universal.default.

sys.std.QSet.QMaybe.attr_or_value

function sys.std.QSet.QMaybe.attr_or_value (Universal <-- QMaybe $topic, Universal $value)

This function results in the q/scalar or q/nonscalar value of the sole attribute of the sole q/tuple of topic, if said q/tuple exists; otherwise, it results in value. This function will warn if the declared type of value isn't a subtype of the declared type of the attribute.

sys.std.QSet.QMaybe.order

function sys.std.QSet.QMaybe.order (Order <-- QMaybe $topic, QMaybe $other, Bool $treat_nothing_as_max, OrdDetFuncRef $ord_func?, QTuple $ord_assuming?, Bool $reverse_order_of_singles?)

This function is a generic (total) order_determination function for QMaybe values. Iff both of its topic and other arguments are identical, this function results in Order:same. Otherwise, iff both of those 2 arguments are QSingle values, then the result of this function is the result of applying to those 2 arguments the (total) order_determination function given in its ord_func argument, as curried by its ord_assuming and reverse_order_of_singles arguments. Otherwise, iff topic is nothing, this function results in Order:increase or Order:decrease respectively when treat_nothing_as_max is Bool:false (the default) or Bool:true. Otherwise (iff other is nothing), this function results in the reverse of when only topic is nothing. In situations where a QMaybe is used analagously to a SQL nullable value and this function is analagous to the dyadic comparison underlying a SQL "ORDER BY", then reverse_order_of_singles designates SQL's "ASC|DESC" and treat_nothing_as_max designates SQL's "NULLS FIRST|LAST".

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.