Type::TableOfIndex -- type
for testing tables with specified indices
Introduction represents
tables with indices (keys) of type Type::TableOfIndex(obj_type)obj_type.
Call(s)testtype(obj,
Type::TableOfIndex(obj_type))
Parametersobj |
- | any MuPAD object |
obj_type |
- | the type of the indices; can be an object of the
library Type or one of
the possible return values of domtype and type |
Returnssee testtype
Related
Functionstesttype, table, Type::TableOfEntry
Detailstesttype(obj,
Type::TableOfIndex(obj_type)) checks, whether
obj is a table and all indices
(keys) are of the type obj_type. If both conditions are
met, the call returns TRUE, otherwise FALSE.obj_type.
Example
1The following table uses identifiers as keys and integers as values:
>> T := table(a = 1, b = 2, c = 3, d = 4): testtype(T, Type::TableOfIndex(DOM_IDENT))
TRUE
Type::TableOfIndex only checks the types of
the keys of the table, so the following call returns
FALSE:
>> T := table(a = 1, b = 2, c = 3, d = 4): testtype(T, Type::TableOfIndex(DOM_INT))
FALSE
>> delete T: