NAME
Language::MuldisD::Ext::Set - Muldis D extension for Set and Maybe specific operators
VERSION
This document is Language::MuldisD::Ext::Set version 0.20.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Language::MuldisD; 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 Set
document describes the system-defined Muldis D Set Extension, which consists of generic operators that are specific to the Set
and Maybe
parameterized 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 Language::MuldisD::Core.
This documentation is pending.
SYSTEM-DEFINED SET-CONCERNING FUNCTIONS
function sys.Set.Set.is_member result Bool params { set(Set), value(ScaTupRel) }
-
This function results in
Bool:true
iff itsvalue
argument matches the sole attribute of a tuple of itsset
argument (that is, iff conceptuallyvalue
is a member ofset
), andBool:false
otherwise. This function will fail if the declared type ofvalue
isn't a subtype of the declared type of the attribute. function sys.Set.Set.is_not_member result Bool params { set(Set), value(ScaTupRel) }
-
This function is exactly the same as
sys.Set.Set.is_member
except that it results in the opposite boolean value when given the same arguments. function sys.Set.Set.insertion result Set params { set(Set), value(ScaTupRel) }
-
This function results in a
Set
that is the relational union ofset
and a Set whose sole 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.Set.Set.disjoint_insertion result Set params { set(Set), value(ScaTupRel) }
-
This function is exactly the same as
sys.Set.Set.insertion
except that it will fail ifvalue
already exists inset
. function sys.Set.Set.deletion result Set params { set(Set), value(ScaTupRel) }
-
This function results in a
Set
that is the relational difference fromset
of a Set whose sole 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.Set.Set.reduction result ScaTupRel params { topic(Set), func(Cat.NameChain), assuming(Tuple), identity(ScaTupRel) }
-
This function is a generic reduction operator that recursively takes each pair of input values in
topic
and applies an argument-specified scalar or 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 scalar or 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 if the declared type ofidentity
isn't a subtype of the declared type of the sole attribute oftopic
. function sys.Set.Set.maybe_reduction result Maybe params { topic(Set), func(Cat.NameChain), assuming(Tuple) }
-
This function is exactly the same as
sys.Set.Set.reduction
except that it does not take anassuming
argument, and it results in aMaybe
of what is otherwise the result type, and that result has zero elements if the argument has zero elements. function sys.Set.Set.Set_from_wrap result SetOfTuple params { topic(Relation) }
-
This function results in a
Set
whose sole attribute is tuple-typed and the attribute values are all the tuples oftopic
; is a short-hand for a relational wrap of all attributes oftopic
such that the new tuple-valued attribute is namedvalue
. function sys.Set.Set.Set_from_attr result Set params { topic(Relation), name(Cat.Name) }
-
This function results in a
Set
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 MAYBE-CONCERNING FUNCTIONS
function sys.Set.Maybe.nothing result Nothing params {}
-
This selector function results in the only zero-tuple Maybe value.
function sys.Set.Maybe.single result Single params { value(ScaTupRel) }
-
This selector function results in the Maybe value with a single tuple whose
value
attribute's value is thevalue
argument. function sys.Set.Maybe.attr result ScaTupRel params { topic(Single) }
-
This function results in the scalar or nonscalar value of the sole attribute of the sole tuple of its argument, which always exists when the argument is a
Single
. function sys.Set.Maybe.attr_or_default result ScaTupRel params { topic(Maybe) }
-
This function results in the scalar or nonscalar value of the sole attribute of the sole tuple of its argument, if said tuple exists; otherwise, it results in the default value of the declared type of the said attribute.
function sys.Set.Maybe.attr_or_value result ScaTupRel params { topic(Maybe), value(ScaTupRel) }
-
This function results in the scalar or nonscalar value of the sole attribute of the sole tuple of
topic
, if said tuple exists; otherwise, it results invalue
. This function will fail if the declared type ofvalue
isn't a subtype of the declared type of the attribute.
SEE ALSO
Go to Language::MuldisD for the majority of distribution-internal references, and Language::MuldisD::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 Language::MuldisD for details.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Language::MuldisD apply to this file too.