=pod =encoding utf8 =head1 NAME Muldis::D::Core::Set - Muldis D Set and Maybe specific operators =head1 VERSION This document is Muldis::D::Core::Set version 0.148.0. =head1 PREFACE This document is part of the Muldis D language specification, whose root document is L; you should read that root document before you read this one, which provides subservient details. Moreover, you should read the L document before this current document, as that forms its own tree beneath a root document branch. =head1 DESCRIPTION This document describes generic operators that are specific to the C and C parameterized relation types, and said operators are short-hands for more generic relational operators. I =head1 FUNCTIONS IMPLEMENTING VIRTUAL COLLECTIVE FUNCTIONS =head2 sys.std.Core.Set.has_member C<< function has_member (Bool <-- coll : Set, value : Universal) implements sys.std.Core.Collective.has_member {...} >> This function results in C iff its C argument matches the sole attribute of a tuple of its C argument (that is, iff conceptually C is a member of C), and C otherwise. This function will warn if its 2 arguments are incompatible as per C. =head2 sys.std.Core.Set.has_not_member C<< function has_not_member (Bool <-- coll : Set, value : Universal) implements sys.std.Core.Collective.has_not_member {...} >> This function is exactly the same as C except that it results in the opposite boolean value when given the same arguments. =head2 sys.std.Core.Set.value_is_member C<< function value_is_member (Bool <-- value : Universal, coll : Set) implements sys.std.Core.Collective.value_is_member {...} >> This function is an alias for C. This function results in C iff its C argument matches the sole attribute of a tuple of its C argument (that is, iff conceptually C is a member of C), and C otherwise. =head2 sys.std.Core.Set.value_is_not_member C<< function value_is_not_member (Bool <-- value : Universal, coll : Set) implements sys.std.Core.Collective.value_is_not_member {...} >> This function is an alias for C. This function is exactly the same as C except that it results in the opposite boolean value when given the same arguments. =head1 GENERIC RELATIONAL FUNCTIONS FOR SETS =head2 sys.std.Core.Set.insertion C<< function insertion (Set <-- set : Set, value : Universal) {...} >> This function results in a C that is the relational union of C and a Set whose sole tuple has the sole attribute value of C; that is, conceptually the result is C inserted into C. As a trivial case, if C already exists in C, then the result is just C. =head2 sys.std.Core.Set.disjoint_ins C<< function disjoint_ins (Set <-- set : Set, value : Universal) {...} >> This function is exactly the same as C except that it will fail if C already exists in C. =head2 sys.std.Core.Set.deletion C<< function deletion (Set <-- set : Set, value : Universal) {...} >> This function results in a C that is the relational difference from C of a Set whose sole tuple has the sole attribute value of C; that is, conceptually the result is C deleted from C. As a trivial case, if C already doesn't exist in C, then the result is just C. =head2 sys.std.Core.Set.reduction C<< function reduction (Universal <-- topic : Set, func : ValRedCFuncNC, identity : Universal) {...} >> This function is a generic reduction operator that recursively takes each pair of input values in C and applies an argument-specified scalar or nonscalar value-resulting C function (which is both commutative and associative) to the pair until just one input value is left, which is the result. The C function to apply is named in the C argument, and that function must have 2 parameters named C and C, which take the 2 input scalar or nonscalar values for an invocation. If C has zero values, then C results in the value given in C. I may be changed to take a function name rather than a value, for consistency with C.> This function will fail|warn if the |declared type of C isn't a subtype of the |declared type of the sole attribute of C. =head2 sys.std.Core.Set.Set_from_wrap C<< function Set_from_wrap (set_of.Tuple <-- topic : Relation) {...} >> This function results in a C whose sole attribute is tuple-typed and the attribute values are all the tuples of C; is a short-hand for a relational wrap of all attributes of C such that the new tuple-valued attribute is named C. =head2 sys.std.Core.Set.Set_from_attr C<< function Set_from_attr (Set <-- topic : Relation, name : Name) {...} >> This function results in a C consisting of all the values of the attribute of C named by C. It is a short-hand for a unary projection of just the named attribute plus its renaming to C. =head1 GENERIC RELATIONAL FUNCTIONS FOR MAYBES =head2 sys.std.Core.Set.Maybe.Nothing C<< function Nothing (Maybe <--) {...} >> This C selector function results in the only zero-tuple Maybe value, which is known by the special name C, aka C, aka I aka C<∅>. =head2 sys.std.Core.Set.Maybe.just C<< function just (Just <-- value : Universal) {...} >> This selector function results in the Maybe value with a single tuple whose C attribute's value is the C argument. =head2 sys.std.Core.Set.Maybe.attr C<< function attr (Universal <-- topic : Just) {...} >> 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 C. Note that this operation is also known as C<.{*}>. =head2 sys.std.Core.Set.Maybe.attr_or_default C<< function attr_or_default (Universal <-- topic? : array_of.Maybe, default : APTypeNC) {...} >> This function results in the scalar or nonscalar value of the sole attribute of the sole tuple of the lowest-indexed of its N C input element values where said element isn't equal to C, if there is such an element; otherwise, it results in the default value of the scalar or nonscalar data type whose name is given in the C argument. This function is a short-hand for invoking C with the result from invoking C. =head2 sys.std.Core.Set.Maybe.attr_or_value C<< function attr_or_value (Universal <-- topic? : array_of.Maybe, value : Universal) {...} >> This function results in the scalar or nonscalar value of the sole attribute of the sole tuple of the lowest-indexed of its N C input element values where said element isn't equal to C, if there is such an element, and otherwise it results in C. This function will warn if the declared type of C isn't a subtype of the declared type of the attribute. Note that this operation is also known as C. In situations where a C is used analogously to a SQL nullable value, this function is analogous to the N-adic SQL COALESCE function. =head2 sys.std.Core.Set.Maybe.order C<< function order (Order <-- topic : Maybe, other : Maybe, J_ord_func? : OrdDetCFuncNC, J_is_reverse_order? : Bool, N_is_after_all_J : Bool, is_reverse_order? : Bool) {...} >> This function is a generic (total) C function for C values. Iff both of its C and C arguments are identical, this function results in C. Otherwise, iff both of those 2 arguments are C values, then the result of this function is the result of applying to those 2 arguments the (total) C function given in its C argument, as curried by its C argument; to be specific, the C function takes the attribute values of C and C, not the whole C values. Otherwise, iff C is C, this function results in C or C respectively when C is C (the default) or C. Otherwise (iff C is C), this function results in the reverse of when only C is C. The C argument is applied to the result of this function I all of the other arguments are applied; if it is C, it does not change the result; if it is C, then it reverses the result. In situations where a C is used analogously to a SQL nullable value and this function is analogous to the dyadic comparison underlying a SQL "ORDER BY", then C designates SQL's "ASC|DESC" and C designates SQL's "NULLS FIRST|LAST". =head1 SEE ALSO Go to L for the majority of distribution-internal references, and L for the majority of distribution-external references. =head1 AUTHOR Darren Duncan (C) =head1 LICENSE AND COPYRIGHT This file is part of the formal specification of the Muldis D language. Muldis D is Copyright © 2002-2011, Muldis Data Systems, Inc. See the LICENSE AND COPYRIGHT of L for details. =head1 TRADEMARK POLICY The TRADEMARK POLICY in L applies to this file too. =head1 ACKNOWLEDGEMENTS The ACKNOWLEDGEMENTS in L apply to this file too. =cut