Type::SequenceOf -- type for
testing sequences
IntroductionWith Type::SequenceOf, sequences with specified objects
can be identified.
Call(s)testtype(obj, Type::SequenceOf(obj_type <, min_nr
<, max_nr>>))
Parametersobj |
- | any MuPAD object |
obj_type |
- | the type of the objects; a type can be an object of
the library Type or one
of the possible return values of domtype and type |
min_nr |
- | the minimal number of objects as nonnegative integer |
max |
- | the maximal number of objects as nonnegative integer |
Returnssee testtype
Related
Functions_exprseq, testtype, Type::ListOf
Detailstesttype(obj,
Type::SequenceOf(obj_type)) checks, whether
obj is a sequence
with elements of the given type obj_type. In that case, it
TRUE, otherwise FALSE.DOM_EXPR and the type "_exprseq".obj_type <, min_nr
<, max_nr>>.min_nr and
max_nr determine the minimum and maximum number of
arguments of the analysed sequence, respectively. If the numbers are
not be given, the number of elements of the sequence will not be
checked. If only the minimum is given, the sequence must have at least
min_nr elements for the test to succeed.
Example
1Is the given sequence a sequence of identifiers?
>> testtype((a, b, c, d, e, f), Type::SequenceOf(DOM_IDENT))
TRUE
Is the given sequence a sequence of at least five real numbers?
>> testtype((0, 0.5, 1, 1.5, 2, 2.5, 3), Type::SequenceOf(Type::Real, 5))
TRUE