NAME
Muldis::D::Ext::QSet - Muldis D extension for QSet and QMaybe specific operators
VERSION
This document is Muldis::D::Ext::QSet version 0.55.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.
function sys.std.QSet.is_member result Bool params { set(QSet), value(Universal) }-
This function results in
Bool:trueiff itsvalueargument matches the sole attribute of a q/tuple of itssetargument (that is, iff conceptuallyvalueis a member ofset), andBool:falseotherwise. This function will warn if its 2 arguments are incompatible as persys.std.Core.QRelation.is_subset. function sys.std.QSet.is_not_member result Bool params { set(QSet), value(Universal) }-
This function is exactly the same as
sys.std.QSet.is_memberexcept that it results in the opposite boolean value when given the same arguments. function sys.std.QSet.insertion result QSet params { set(QSet), value(Universal) }-
This function results in a
QSetthat is the relational union ofsetand a QSet whose sole q/tuple has the sole attribute value ofvalue; that is, conceptually the result isvalueinserted intoset. As a trivial case, ifvaluealready exists inset, then the result is justset. function sys.std.QSet.disjoint_insertion result QSet params { set(QSet), value(Universal) }-
This function is exactly the same as
sys.std.QSet.insertionexcept that it will fail ifvaluealready exists inset. function sys.std.QSet.deletion result QSet params { set(QSet), value(Universal) }-
This function results in a
QSetthat is the relational difference fromsetof a QSet whose sole q/tuple has the sole attribute value ofvalue; that is, conceptually the result isvaluedeleted fromset. As a trivial case, ifvaluealready doesn't exist inset, then the result is justset. function sys.std.QSet.reduction result Universal params { topic(QSet), func(FuncRef), assuming(QTuple)?, identity(Universal) }-
This function is a generic reduction operator that recursively takes each pair of input values in
topicand 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 thefuncargument, and that function must have 3 arguments namedv1,v2,assuming; the last parameter is curried with the same-named argument ofreduction, and the first 2 parameters are the 2 input q/scalar or q/nonscalar values for an invocation. Iftopichas zero values, thenreductionresults in the value given inidentity. Note thatidentitymay be changed to take a function name rather than a value, for consistency withfunc. This function will fail|warn if the |declared type ofidentityisn't a subtype of the |declared type of the sole attribute oftopic. function sys.std.QSet.maybe_reduction result QMaybe params { topic(QSet), func(FuncRef), assuming(QTuple)? }-
This function is exactly the same as
sys.std.QSet.reductionexcept that it does not take anassumingargument, and it results in aQMaybeof what is otherwise the result type, and that result has zero elements if the argument has zero elements. function sys.std.QSet.QSet_from_wrap result set_of.QTuple params { topic(QRelation) }-
This function results in a
QSetwhose sole attribute is q/tuple-typed and the attribute 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. function sys.std.QSet.QSet_from_attr result QSet params { topic(QRelation), name(Name) }-
This function results in a
QSetconsisting 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.
SYSTEM-DEFINED QUASI-/MAYBE-CONCERNING FUNCTIONS
function sys.std.QSet.QMaybe.nothing result Nothing params {}-
This selector function results in the only zero-tuple QMaybe value.
function sys.std.QSet.QMaybe.single result QSingle params { value(Universal) }-
This selector function results in the QMaybe value with a single q/tuple whose
valueattribute's value is thevalueargument. function sys.std.QSet.QMaybe.attr result Universal params { topic(QSingle) }-
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. function sys.std.QSet.QMaybe.attr_or_default result Universal params { topic(QMaybe), default(TypeRef) }-
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
defaultargument. This function is a short-hand for invokingattr_or_valuewith the result from invokingsys.std.Core.Universal.default. function sys.std.QSet.QMaybe.attr_or_value result Universal params { topic(QMaybe), value(Universal) }-
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 invalue. This function will warn if the declared type ofvalueisn't a subtype of the declared type of the attribute. function sys.std.QSet.QMaybe.order result Order params { topic(QMaybe), other(QMaybe), treat_nothing_as_max(Bool), ord_func(OrdDetFuncRef)?, ord_assuming(QTuple)?, reverse_order_of_singles(Bool)? }-
This function is a generic (total)
order_determinationfunction forQMaybevalues. Iff both of itstopicandotherarguments are identical, this function results inOrder:same. Otherwise, iff both of those 2 arguments areQSinglevalues, then the result of this function is the result of applying to those 2 arguments the (total)order_determinationfunction given in itsord_funcargument, as curried by itsord_assumingargument; ifreverse_order_of_singlesisBool:truethensys.std.Core.Cat.Order_reverseis also applied such that the result oford_funcis reversed, and otherwise it isn't applied. Otherwise, ifftopicisNothing, this function results inOrder:increaseorOrder:decreaserespectively whentreat_nothing_as_maxisBool:false(the default) orBool:true. Otherwise (iffotherisNothing), this function results in the reverse of when onlytopicisNothing. In situations where aQMaybeis used analagously to a SQL nullable value and this function is analagous to the binary comparison underlying a SQL "ORDER BY", thenreverse_order_of_singlesdesignates SQL's "ASC|DESC" andtreat_nothing_as_maxdesignates 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-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.