=pod =encoding utf8 =head1 NAME Muldis::D::Core::Scalar - Muldis D operators for all scalar types =head1 VERSION This document is Muldis::D::Core::Scalar 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 essentially all of the core Muldis D generic scalar operators, applicable to all scalar types. I =head1 GENERIC FUNCTIONS FOR SCALARS These functions are applicable to mainly scalar types, but are generic in that they typically work with any scalar types. Now some of these functions (those with a parameter named C) work only with scalar values that have possreps, and not with values of the 2 system-defined scalar types lacking any possreps: C, C; other functions are not limited in that way, but may be limited in other ways. Note that the terminology used to describe these functions is taking advantage of the fact that a scalar possrep looks just like a tuple. Each C and C parameter is optional and each defaults to the empty string if no explicit argument is given to it. =head2 sys.std.Core.Scalar.attr C<< function attr (Universal <-- topic : ScalarWP, possrep? : Name, name? : Name) {...} >> This function results in the scalar or nonscalar value of the possrep attribute of C where the possrep name is given by C and the attribute name is given by C. This function will fail if C specifies a possrep name that C doesn't have or C specifies an attribute name that the named possrep of C doesn't have. Note that this operation is also known as C<.{:}>. =head2 sys.std.Core.Scalar.update_attr C<< function update_attr (ScalarWP <-- topic : ScalarWP, possrep? : Name, name? : Name, value : Universal) {...} >> This function results in its C argument but that its possrep attribute whose possrep name is C and whose attribute name is C has been updated with a new scalar or nonscalar value given by C. This function will fail if C specifies a possrep name that C doesn't have or C specifies an attribute name that the named possrep of C doesn't have, or if C isn't of the declared type of the attribute; this function will otherwise warn if the declared type of C isn't a subtype of the declared type of the attribute. =head2 sys.std.Core.Scalar.multi_update C<< function multi_update (ScalarWP <-- topic : ScalarWP, possrep? : Name, attrs : Tuple) {...} >> This function is like C except that it handles N scalar possrep attributes at once rather than just 1. The heading of the C argument must be a subset of the heading of the C argument's possrep named by C; this function's result is C with all the possrep attribute values of C substituted into it. This function could alternately be named I. =head2 sys.std.Core.Scalar.projection C<< function projection (Tuple <-- topic : ScalarWP, possrep? : Name, attr_names : set_of.Name) {...} >> This function results in the C that is the projection of the possrep (whose name is given in the C argument) of its C argument that has just the subset of attributes of C which are named in its C argument. As a trivial case, this function's result is the entire named possrep of C if C lists all attributes of that possrep; or, it is the nullary tuple if C is empty. This function will fail if C specifies a possrep name that C doesn't have or C specifies any attribute names that C doesn't have. Note that this operation is also known as C<{:}>. =head2 sys.std.Core.Scalar.cmpl_proj C<< function cmpl_proj (Tuple <-- topic : ScalarWP, possrep? : Name, attr_names : set_of.Name) {...} >> This function is the same as C but that it results in the complementary subset of possrep attributes of C when given the same arguments. Note that this operation is also known as C<{:!}>. =head2 sys.std.Core.Scalar.Tuple_from_Scalar C<< function Tuple_from_Scalar (Tuple <-- topic : ScalarWP, possrep? : Name) {...} >> This function results in the C that has all the same attributes of the possrep of C whose name is given in C; in other words, the function results in the externalization of one of a scalar value's possreps. This function will fail if C specifies a possrep name that C doesn't have. =head2 sys.std.Core.Scalar.Scalar_from_Tuple C<< function Scalar_from_Tuple (ScalarWP <-- topic : Tuple, type : APTypeNC, possrep? : Name) {...} >> This function results in the C value whose scalar root [|sub]type is named by C, which has a possrep whose name matches C, and whose complete set of attributes of that named possrep match the attributes of C. This function can be used to select any scalar value at all that has a possrep. =head2 sys.std.Core.Scalar.has_possrep C<< function has_possrep (Bool <-- topic : ScalarWP, possrep? : Name) {...} >> This function results in C iff its C argument has a possrep whose name is given by C; otherwise it results in C. =head2 sys.std.Core.Scalar.possrep_names C<< function possrep_names (set_of.Name <-- topic : ScalarWP) {...} >> This function results in the set of the names of the possreps of its argument. =head2 sys.std.Core.Scalar.degree C<< function degree (NNInt <-- topic : ScalarWP, possrep? : Name) {...} >> This function results in the degree of its C argument's possrep whose name is given by C (that is, the count of attributes the possrep has). =head2 sys.std.Core.Scalar.has_attrs C<< function has_attrs (Bool <-- topic : ScalarWP, possrep? : Name, attr_names : set_of.Name) {...} >> This function results in C iff, for every one of the attribute names specified by its C argument, its C argument's possrep whose name is given by C has an attribute with that name; otherwise it results in C. As a trivial case, this function's result is C if C is empty. =head2 sys.std.Core.Scalar.attr_names C<< function attr_names (set_of.Name <-- topic : ScalarWP, possrep? : Name) {...} >> This function results in the set of the names of the attributes of its C argument's possrep whose name is given by C. =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