Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# Type::ListOf

Type representing lists of objects with the same type

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```testtype(obj, (obj_type, <min_nr, <max_nr>>))
```

## Description

Type::ListOf describes lists of objects of a specified type.

The call testtype(obj, Type::ListOf(obj_types, ...)) checks, whether obj is a list with elements of the given type obj_type, ... and returns TRUE, if it holds, otherwise FALSE.

The two optional parameters min_nr and max_nr determine the minimum and maximum number of elements in the analyzed list. If the numbers are not be given, the number of elements in the list will not be checked. If only the minimum is given, only the minimal number of elements in the list is checked.

Note especially that Type::Union provides a way to allow more than one type for the list elements.

This type does not represent a property.

## Examples

### Example 1

Is the given list a list of identifiers?

`testtype([a, b, c, d, e, f], Type::ListOf(DOM_IDENT))`

Is the given list a list of at least five real numbers?

`testtype([0, 0.5, 1, 1.5, 2, 2.5, 3], Type::ListOf(Type::Real, 5))`

### Example 2

testtype is used to select lists with exactly two identifiers:

```S := {[a], [a, b], [d, 1], [0, d], [e], [d, e]}:
select(S, testtype, Type::ListOf(DOM_IDENT, 2, 2))```

## Parameters

 obj 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_nr The maximal number of objects as nonnegative integer

See testtype