type/list - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

type/list

check for a list

type/set

check for a set

 Calling Sequence type(expr, list) type(expr, set) type(expr, list(K)) type(expr, set(K))

Parameters

 expr - any expression K - type name

Description

 • In the first two calling sequences, the type command checks if expr is a valid Maple list or set. It returns true if expr is a list or set and false otherwise.
 • See the list and set help pages for a description of the list and set datatypes.
 • In the third and fourth calling sequences, where K is a specified type name, the type command checks whether expr is a list or set whose entries are of type K.  That is, type(expr, list(K)) returns true if type(expr, list) is true and type(x, K) is true for each entry x of expr. Sets are checked in a similar manner.
 • See the type help page for a description of valid types in Maple.

Examples

 > $S≔\left\{1,\frac{3}{2},2\right\}$
 ${S}{≔}\left\{{1}{,}{2}{,}\frac{{3}}{{2}}\right\}$ (1)
 > $\mathrm{type}\left(S,\mathrm{set}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(S,\mathrm{set}\left(\mathrm{rational}\right)\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left(S,\mathrm{set}\left(\mathrm{integer}\right)\right)$
 ${\mathrm{false}}$ (4)
 > $L≔\left[{x}^{4}-1,{x}^{2},x+3\right]$
 ${L}{≔}\left[{{x}}^{{4}}{-}{1}{,}{{x}}^{{2}}{,}{x}{+}{3}\right]$ (5)
 > $\mathrm{type}\left(L,\mathrm{list}\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{type}\left(L,\mathrm{list}\left(\mathrm{polynom}\left(\mathrm{integer},x\right)\right)\right)$
 ${\mathrm{true}}$ (7)

 See Also