NAME
Muldis::D::Ext::QBag - Muldis D extension for QBag specific operators
VERSION
This document is Muldis::D::Ext::QBag version 0.56.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 QBag
document describes the system-defined Muldis D QBag Extension, which consists of generic operators that are specific to the QBag
parameterized q/relation type, 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-/BAG-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.QBag.cardinality result NNInt params { topic(QBag) }
-
This function is like
sys.std.Core.QRelation.cardinality
but that it accounts for the greater-than-one multiplicity of values in its argument; it results in the sum of thecount
attribute of its argument. function sys.std.QBag.is_member result Bool params { bag(QBag), value(Universal) }
-
This function is the same as
sys.std.QSet.is_member
, including that matching ofvalue
is done against thevalue
attribute, except that it works with aQBag
rather than aQSet
. function sys.std.QBag.is_not_member result Bool params { bag(QBag), value(Universal) }
-
This function is exactly the same as
sys.std.QBag.is_member
except that it results in the opposite boolean value when given the same arguments. function sys.std.QBag.count result NNInt params { bag(QBag), value(Universal) }
-
This function results in the multiplicity / count of occurrances of
value
inbag
; if a q/tuple exists inbag
whosevalue
attribute isvalue
, then the result is itscount
attribute; otherwise the result is zero. function sys.std.QBag.insertion result QBag params { bag(QBag), value(Universal) }
-
This function is the same as
sys.std.QSet.insertion
as peris_member
but that its result differs depending on whethervalue
already exists inbag
; if it does, then no new q/tuple is added, but thecount
attribute for the matching q/tuple is incremented by 1; if it does not, then a new q/tuple is added where itsvalue
isvalue
and itscount
is 1. function sys.std.QBag.deletion result QBag params { bag(QBag), value(Universal) }
-
This function is the same as
sys.std.QSet.deletion
as peris_member
but that its result differs depending on what thecount
for any q/tuple matchingvalue
that already exists inbag
is; if thecount
is greater than 1, then it is decremented by 1; if it is equal to 1, then the q/tuple whosevalue
isvalue
is deleted. function sys.std.QBag.reduction result Universal params { topic(QBag), func(FuncRef), assuming(QTuple)?, identity(Universal) }
-
This function is the same as
sys.std.QSet.reduction
, including that input values for the reduction come from thevalue
attribute oftopic
, except that it works with aQBag
rather than aQSet
;func
is invoked extra times, where both itsv1
andv2
arguments might be different instances of the same value having >= 2 multiplicity. function sys.std.QBag.maybe_reduction result QMaybe params { topic(QBag), func(FuncRef), assuming(QTuple)? }
-
This function is to
sys.std.QSet.maybe_reduction
assys.std.QBag.reduction
is tosys.std.QSet.reduction
. function sys.std.QBag.QSet_from_QBag result QSet params { topic(QBag) }
-
This function results in the
QSet
that is the projection of thevalue
attribute of itsQBag
argument. function sys.std.QBag.QBag_from_QSet result QBag params { topic(QSet) }
-
This function results in the
QBag
that is the extension of itsQSet
argument with a newcount
attribute whose value for every q/tuple is 1. function sys.std.QBag.QBag_from_wrap result quasi_bag_of.QTuple params { topic(QRelation) }
-
This function results in a
QBag
whosevalue
attribute is q/tuple-typed and that attribute's 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
, and then that result is extended with acount
attribute whose value for every q/tuple is 1. function sys.std.QBag.QBag_from_attr result QBag params { topic(QRelation), name(Name) }
-
This function results in a
QBag
consisting of all the values of the attribute oftopic
named byname
. It is a short-hand for first doing a relational group on all attributes oftopic
besidesname
to produce a new q/relation-typed attribute, and then extending the result of the group with a new positive integer attribute whose values are the cardinality of the q/relation-valued attribute's values, and then doing a binary projection of the named attribute and the new integer attribute plus their renaming tovalue
andcount
respectively. function sys.std.QBag.is_subset result Bool params { look_in(QBag), look_for(QBag) }
-
This function is like
sys.std.Core.QRelation.is_subset
but that it accounts for the greater-than-one multiplicity of values in its arguments; this function returnsBool:true
iff the multiplicity of eachlook_for
value is less than or equal to the multiplicity of its counterpartlook_in
value. function sys.std.QBag.is_not_subset result Bool params { look_in(QBag), look_for(QBag) }
-
This function is like
sys.std.Core.QRelation.is_not_subset
as peris_subset
. function sys.std.QBag.is_proper_subset result Bool params { look_in(QBag), look_for(QBag) }
-
This function is like
sys.std.Core.QRelation.is_proper_subset
as peris_subset
. TODO: What is its definition? function sys.std.QBag.is_not_proper_subset result Bool params { look_in(QBag), look_for(QBag) }
-
This function is like
sys.std.Core.QRelation.is_not_proper_subset
as peris_subset
. TODO: What is its definition? function sys.std.QBag.union result QBag params { topic(quasi_set_of.QBag) }
-
This function is like
sys.std.Core.QRelation.union
but that it just looks at thevalue
attribute of its argument elements when determining what element q/tuples correspond; then for each q/tuple in the result, itscount
attribute value is the maximum of thecount
attribute values of its corresponding input element q/tuples. function sys.std.QBag.intersection result QBag params { topic(quasi_set_of.QBag) }
-
This function is like
sys.std.Core.QRelation.intersection
asunion
is likesys.std.Core.QRelation.union
; the minimum ofcount
attribute values is used rather than the maximum. function sys.std.QBag.difference result QBag params { source(QBag), filter(QBag) }
-
This function is like
sys.std.Core.QRelation.difference
asunion
is likesys.std.Core.QRelation.union
; for corresponding input q/tuples, the result only has a q/tuple with the samevalue
if thecount
of thesource
q/tuple is greater than thecount
of thefilter
q/tuple, and thecount
of the result q/tuple is the difference of those two.
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.