type/attributed - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/attributed

type/attributed

check if an expression has attributes

 Calling Sequence type(expr, 'attributed') type(expr, 'attributed(attr1, attr2, ... )')

Parameters

 expr - any expression attr1, attr2, ... - (optional) expressions representing attributes

Description

 • An expression is of type attributed if it has attributes; that is, if the expression sequence of its attributes is not NULL.
 • The command type(expr, 'attributed') returns true if expression expr is of type attributed. Otherwise, false is returned.
 • By using the second form of the calling sequence, you can check for one or more specific attributes. In this case, the test returns true if the expression expr has all of the specified attributes attr1, attr2, .... Otherwise, false is returned.

Examples

 > $\mathrm{type}\left(\mathrm{sin},'\mathrm{attributed}'\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(\mathrm{sin},'\mathrm{attributed}\left(\mathrm{blue}\right)'\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{type}\left(\mathrm{sin},'\mathrm{attributed}\left(\mathrm{protected}\right)'\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{attributes}\left(\mathrm{sin}\right)$
 ${\mathrm{protected}}{,}{\mathrm{_syslib}}$ (4)
 > $\mathrm{setattribute}\left(\mathrm{foo},'\mathrm{red}','\mathrm{blue}'\right)$
 ${\mathrm{foo}}$ (5)
 > $\mathrm{type}\left(\mathrm{foo},'\mathrm{attributed}'\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{type}\left(\mathrm{foo},'\mathrm{attributed}\left(\mathrm{red}\right)'\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{type}\left(\mathrm{foo},'\mathrm{attributed}\left(\mathrm{blue}\right)'\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{type}\left(\mathrm{foo},'\mathrm{attributed}\left(\mathrm{red},\mathrm{blue}\right)'\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{type}\left(\mathrm{foo},'\mathrm{attributed}\left(\mathrm{red},\mathrm{blue},\mathrm{green}\right)'\right)$
 ${\mathrm{false}}$ (10)