=pod

=encoding utf8

=head1 NAME

Muldis::D::Ext::QTuple -
Muldis D extension adding more generic q/tuple operators

=head1 VERSION

This document is Muldis::D::Ext::QTuple version 0.58.0.

=head1 PREFACE

This document is part of the Muldis D language specification, whose root
document is L<Muldis::D>; you should read that root document
before you read this one, which provides subservient details.

=head1 DESCRIPTION

Muldis D has a mandatory core set of system-defined (eternally available)
entities, which is referred to as the I<Muldis D core> or the I<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 I<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 C<QTuple> document describes the system-defined I<Muldis D
QTuple Extension>, which consists of extra operators for generic q/tuples,
adding to the minimum few defined 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 L<Muldis::D::Core>.

I<This documentation is pending.>

=head1 SYSTEM-DEFINED GENERIC QUASI-/TUPLE-CONCERNING FUNCTIONS

These functions are applicable to mainly q/tuple types, but are generic
in that they typically work with any q/tuple types.

=over

=item C<function sys.std.QTuple.degree result NNInt params { topic(QTuple)
}>

This function results in the degree of its argument (that is, the count of
attributes it has).

=item C<function sys.std.QTuple.is_nullary result Bool params {
topic(QTuple) }>

This function results in C<Bool:true> iff its argument has a degree of zero
(that is, it has zero attributes), and C<Bool:false> otherwise.  By
definition, the only 1 q/tuple value for which this function would result
in C<Bool:true> is the only member of the type C<TupleD0>.

=item C<function sys.std.QTuple.is_not_nullary result Bool params {
topic(QTuple) }>

This function is exactly the same as C<sys.std.QTuple.is_nullary> except
that it results in the opposite boolean value when given the same argument.

=item C<function sys.std.QTuple.has_attrs result Bool params {
topic(QTuple), attrs(set_of.Name) }>

This function results in C<Bool:true> iff, for every one of the attribute
names specified by its C<attrs> argument, its C<topic> argument has an
attribute with that name; otherwise it results in C<Bool:false>.  As a
trivial case, this function's result is C<Bool:true> if C<attrs> is empty.

=item C<function sys.std.QTuple.attr_names result set_of.Name params {
topic(QTuple) }>

This function results in the set of the names of the attributes of its
argument.

=item C<function sys.std.QTuple.attr_from_QTuple result Universal params {
topic(QTuple) }>

This function results in the q/scalar or q/nonscalar value of the sole
attribute of its argument.  This function will fail if its argument is not
of degree 1.

=item C<function sys.std.QTuple.QTuple_from_attr result QTuple params {
name(Name), value(Universal) }>

This function results in the C<QTuple> value which has just one attribute
whose name is given by C<name> and whose value is given by C<value>.

=item C<function sys.std.QTuple.substitution_in_default result QTuple
params { of(TypeRef), subst(QTuple) }>

This function results in the q/tuple value that is the default value of the
q/tuple data type whose name is given in the C<of> argument, but that zero
or more of its attribute values have been substituted by values given in
the C<subst> argument.  This function is a short-hand for
C<sys.std.Core.QTuple.multi_update> on the result of
C<sys.std.Core.Universal.default>.  This function will fail if either
C<default> would fail for the same C<of> argument, or if its result isn't a
q/tuple type, or if the heading of C<subst> isn't a subset of the heading
of the default.  The purpose of this function is to support greater brevity
in Muldis D coding such that users can define just part of a desired
q/tuple value and have the remainder filled in from defaults for them;
particularly useful with q/tuples that conceptually have some optional
attributes.

=back

=head1 SEE ALSO

Go to L<Muldis::D> for the majority of distribution-internal
references, and L<Muldis::D::SeeAlso> for the majority of
distribution-external references.

=head1 AUTHOR

Darren Duncan (C<perl@DarrenDuncan.net>)

=head1 LICENSE AND COPYRIGHT

This file is part of the formal specification of the Muldis D language.

Muldis D is Copyright © 2002-2009, Darren Duncan.

See the LICENSE AND COPYRIGHT of L<Muldis::D> for details.

=head1 TRADEMARK POLICY

The TRADEMARK POLICY in L<Muldis::D> applies to this file too.

=head1 ACKNOWLEDGEMENTS

The ACKNOWLEDGEMENTS in L<Muldis::D> apply to this file too.

=cut
