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 its value argument matches the sole attribute of a tuple of its set argument (that is, iff conceptually value is a member of set), and Bool:false otherwise. This function will fail if the declared type of value 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 of set and a Set whose sole 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.

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 if value already exists in set.

function sys.Set.Set.deletion result Set params { set(Set), value(ScaTupRel) }

This function results in a Set that is the relational difference from set of a Set whose sole 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.

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 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 scalar or 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 if the declared type of identity isn't a subtype of the declared type of the sole attribute of topic.

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 an assuming argument, and it results in a Maybe 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 of topic; is a short-hand for a relational wrap of all attributes of topic such that the new tuple-valued attribute is named value.

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 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 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 the value 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 in value. This function will fail if the declared type of value 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.