NAME
Muldis::D::Ext::Sequence - Muldis D extension for Seq specific operators
VERSION
This document is Muldis::D::Ext::Sequence version 0.24.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Muldis::D; 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 Sequence
document describes the system-defined Muldis D Sequence Extension, which consists of generic operators that are specific to the Seq
parameterized relation type, 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 Muldis::D::Core.
This documentation is pending.
SYSTEM-DEFINED SEQUENCE-CONCERNING FUNCTIONS
function sys.std.Sequence.last_index result UInt params { topic(Seq) }
-
This function results in
index
attribute value of the last element oftopic
; that is, it results in 1 less than the cardinality oftopic
. function sys.std.Sequence.value result ScaTupRel params { topic(Seq), index(UInt) }
-
This function results in the scalar or nonscalar
value
attribute of the tuple oftopic
whoseindex
attribute isindex
. This function will fail if no tuple exists intopic
with the specified index. function sys.std.Sequence.update_value result Seq params { topic(Seq), index(UInt), value(ScaTupRel) }
-
This function results in its
topic
argument but that thevalue
attribute of the tuple oftopic
whoseindex
attribute isindex
has been updated with a new scalar or nonscalar value given byvalue
. This function will fail if no tuple exists intopic
with the specified index, or if the declared type ofvalue
isn't a subtype of the declared type of thevalue
attribute. function sys.std.Sequence.insertion result Seq params { topic(Seq), index(UInt), value(ScaTupRel) }
-
This function results in its
topic
argument but that a new tuple has been inserted whoseindex
isindex
and whosevalue
isvalue
; any existing tuples withindex
values greater than or equal toindex
had theirs incremented by 1. As a trivial case, ifindex
is equal to zero or is equal to the cardinality oftopic
, thenvalue
has become the new first or last (or only) element, respectively. This function will fail ifindex
is greater than the cardinality oftopic
, or if the declared type ofvalue
isn't a subtype of the declared type of thevalue
attribute. function sys.std.Sequence.deletion result Seq params { topic(Seq), index(UInt) }
-
This function results in its
topic
argument but that a tuple has been deleted whoseindex
isindex
; any existing tuples withindex
values greater than or equal toindex
had theirs decremented by 1. This function will fail if no tuple exists intopic
with the specified index. function sys.std.Sequence.is_element result Bool params { topic(Seq), value(ScaTupRel) }
-
This function results in
Bool:true
iff itsvalue
argument matches thevalue
attribute of at least one tuple of itstopic
argument (that is, iff conceptuallyvalue
is an element oftopic
), andBool:false
otherwise. This function will fail if the declared type ofvalue
isn't a subtype of the declared type of that attribute. function sys.std.Sequence.is_not_element result Bool params { topic(Seq), value(ScaTupRel) }
-
This function is exactly the same as
sys.std.Sequence.is_element
except that it results in the opposite boolean value when given the same arguments. function sys.std.Sequence.reduction result ScaTupRel params { topic(Seq), func(Cat.NameChain), assuming(Tuple), identity(ScaTupRel) }
-
This function is the same as
sys.std.Set.reduction
, including that input values for the reduction come from thevalue
attribute oftopic
, except that it works with aSeq
rather than aSet
. Also, the function named infunc
is only associative, and not commutative; the arguments tov1
andv2
offunc
are guaranteed to be consecutive input elements, with the result returning to their place in sequence beween the other input elements. function sys.std.Sequence.maybe_reduction result Maybe params { topic(Seq), func(Cat.NameChain), assuming(Tuple) }
-
This function is to
sys.std.Set.maybe_reduction
assys.std.Sequence.reduction
is tosys.std.Set.reduction
. function sys.std.Sequence.slice result Seq params { topic(Seq), first_index(UInt), last_index(UInt) }
-
This function results in the sub-sequence of its
topic
argument that is specified by itsfirst_index
andlast_index
arguments, which specify the inclusive source-index
range of the elements of the result. This function will fail iflast_index
is beforefirst_index
. It is valid forfirst_index
orlast_index
to be greater than the last index oftopic
; in the first case, the result has zero elements; in the second case, the result has all remaining elements starting atfirst_index
. Iftopic
has any elements andfirst_index
matches the index of a source element, then the result will always have at least 1 element. function sys.std.Sequence.catenation result Seq params { topic(seq_of.Seq) }
-
This function results in the catenation of the N element values of its argument; it is a reduction operator that recursively takes each consecutive pair of input values and catenates (which is associative) them together until just one is left, which is the result. To catenate 2
Seq
means to union their tuples after first increasing all theindex
values of the second one by the cardinality of the first one. Iftopic
has zero values, thencatenate
results in the empty sequence value, which is the identity value for catenate. function sys.std.Sequence.repeat result Seq params { topic(Seq), count(UInt) }
-
This function results in the catenation of
count
instances oftopic
. function sys.std.Sequence.reverse result Seq params { topic(Seq) }
-
This function results in its argument but that the order of its elements has been reversed. For example, the input
{ 0=>'a', 1=>'b', 2=>'c', 3=>'d'}
results in{ 0=>'d', 1=>'c', 2=>'b', 3=>'a' }
. function sys.std.Sequence.is_subseq result Bool params { look_in(Seq), look_for(Seq) }
-
This function results in
Bool:true
iff the sequence of values comprisinglook_for
is a sub-sequence of the sequence of valueslook_in
, andBool:false
otherwise. This function will fail if the 2 arguments don't have the same heading. function sys.std.Sequence.is_not_subseq result Bool params { look_in(Seq), look_for(Seq) }
-
This function is exactly the same as
sys.std.Sequence.is_subseq
except that it results in the opposite boolean value when given the same arguments. function sys.std.Sequence.Seq_from_wrap result seq_of.Tuple params { topic(Relation), ord_func(Cat.NameChain), ord_assuming(Tuple) }
-
This function results in a
Seq
whosevalue
attribute is tuple-typed and that attribute's 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
, and then that result is extended with anindex
attribute whose values result from a rank of the tuples, where the ranked-first tuple has anindex
of zero, and so on. This function is a wrapper over the (total)order_determination
function named in itsord_func
argument when the latter function is curried by itsord_assuming
argument; this wrapped function is used to rank the tuples, with each invocation getting atopic
tuple as each itstopic
andother
arguments. See also thesys.std.Relation.rank
function, which is the same assys.std.Sequence.Seq_from_wrap
but that it just adds an attribute to the source tuples and does not wrap them. function sys.std.Sequence.limit_of_Seq_from_wrap result seq_of.Tuple params { topic(Relation), func(Cat.NameChain), assuming(Tuple), first_index(UInt), last_index(UInt) }
-
This function is a short-hand for invoking first
sys.std.Sequence.Seq_from_wrap
and thensys.std.Sequence.slice
on its result. This function is tosys.std.Sequence.Seq_from_wrap
what thesys.std.Relation.limit
function is tosys.std.Relation.rank
. function sys.std.Sequence.Seq_from_attr result Seq params { topic(Relation), name(Cat.Name), ord_func(Cat.NameChain), ord_assuming(Tuple) }
-
This function results in a
Seq
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
, and then that result is extended with anindex
attribute whose values result from a rank of the source attribute values, where the ranked-first source value has anindex
of zero, and so on. This function is otherwise the same assys.std.Sequence.Seq_from_wrap
.
SEE ALSO
Go to Muldis::D for the majority of distribution-internal references, and Muldis::D::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 Muldis::D for details.
TRADEMARK POLICY
The TRADEMARK POLICY in Muldis::D applies to this file too.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Muldis::D apply to this file too.