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:true
iff itsvalue
argument matches the sole attribute of a q/tuple of itsset
argument (that is, iff conceptuallyvalue
is a member ofset
), andBool:false
otherwise. 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_member
except 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
QSet
that is the relational union ofset
and a QSet whose sole q/tuple has the sole attribute value ofvalue
; that is, conceptually the result isvalue
inserted intoset
. As a trivial case, ifvalue
already 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.insertion
except that it will fail ifvalue
already exists inset
. function sys.std.QSet.deletion result QSet params { set(QSet), value(Universal) }
-
This function results in a
QSet
that is the relational difference fromset
of a QSet whose sole q/tuple has the sole attribute value ofvalue
; that is, conceptually the result isvalue
deleted fromset
. As a trivial case, ifvalue
already 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
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 thefunc
argument, 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. Iftopic
has zero values, thenreduction
results in the value given inidentity
. Note thatidentity
may be changed to take a function name rather than a value, for consistency withfunc
. This function will fail|warn if the |declared type ofidentity
isn'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.reduction
except that it does not take anassuming
argument, and it results in aQMaybe
of 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
QSet
whose 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 oftopic
such 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
QSet
consisting of all the values of the attribute oftopic
named 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
value
attribute's value is thevalue
argument. 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
default
argument. This function is a short-hand for invokingattr_or_value
with 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 ofvalue
isn'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_determination
function forQMaybe
values. Iff both of itstopic
andother
arguments are identical, this function results inOrder:same
. Otherwise, iff both of those 2 arguments areQSingle
values, then the result of this function is the result of applying to those 2 arguments the (total)order_determination
function given in itsord_func
argument, as curried by itsord_assuming
argument; ifreverse_order_of_singles
isBool:true
thensys.std.Core.Cat.Order_reverse
is also applied such that the result oford_func
is reversed, and otherwise it isn't applied. Otherwise, ifftopic
isNothing
, this function results inOrder:increase
orOrder:decrease
respectively whentreat_nothing_as_max
isBool:false
(the default) orBool:true
. Otherwise (iffother
isNothing
), this function results in the reverse of when onlytopic
isNothing
. In situations where aQMaybe
is used analagously to a SQL nullable value and this function is analagous to the binary comparison underlying a SQL "ORDER BY", thenreverse_order_of_singles
designates SQL's "ASC|DESC" andtreat_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-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.