type/assignable - Maple Programming Help

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

type/assignable

check if an object can be assigned to

 Calling Sequence type(expr, assignable) type(expr, assignable(t))

Parameters

 expr - any expression t - type

Description

 • The function type(expr, 'assignable') returns true if the expression expr can be assigned to; otherwise, it returns false.
 • If the parameter t is included, it checks that expr is also of that type.
 • An expression is assignable if one of the following is true:
 - It is a symbol and it is not protected.
 - It is of type indexed and its zeroth operand is either assignable or a table or an rtable.
 - It is of type function and its zeroth operand is assignable.

Examples

 > $\mathrm{type}\left({x}_{0}\left(4\right),\mathrm{assignable}\right)$
 ${\mathrm{true}}$ (1)
 > ${x}_{0}\left(4\right)≔7$
 ${{x}}_{{0}}{}\left({4}\right){≔}{7}$ (2)
 > $\mathrm{type}\left({x}_{0},\mathrm{assignable}\left(\mathrm{name}\right)\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left(f\left(x\right),\mathrm{assignable}\left(\mathrm{name}\right)\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{type}\left(\mathrm{true},\mathrm{assignable}\left(\mathrm{name}\right)\right)$
 ${\mathrm{false}}$ (5)