whattype
query the basic data type of an expression
Calling Sequence
Parameters
Description
Examples
whattype(expr)
whattype[kernel](expr)
expr
-
any expression
The whattype(expr) function returns the data type name of expr, which may be any of the following basic data types:
`*`
`+`
`..`
`::`
`<`
`<=`
`<>`
`=`
`^`
`||`
`and`
Array
array
assignment
complex(extended_numeric)
`do`
exprseq
extended_numeric
float
foreign
fraction
function
hfarray
`if`
`implies`
indexed
integer
list
Matrix
`module`
moduledefinition
`not`
object
`or`
package
procedure
python
record
SDMPoly
series
set
string
symbol
table
uneval
unknown
Vector[column]
Vector[row]
`xor`
zppoly
Although exprseq is not a type name known to the type function, it is the name of the internal data structure for expression sequences.
For a general expression, whattype returns the "top level" data type as determined by the order of precedence of the operators.
If the expression is an object whose type name occurs either the object itself, or specifically to whattype, the object type's name is returned. If the object's type is not known, whattype returns object as the type.
The whattype function produces slightly different output if invoked as whattype[kernel](expr):
If expr is a software or hardware floating point, whattype returns float or hfloat respectively, instead of returning float for both cases.
If expr is an object, whattype returns object for any object, even if it has a known name.
whattype⁡x+y
whattype⁡x−y
whattype⁡−x
whattype⁡x2⁢f⁡y
whattype⁡xy
whattype⁡1x
whattype⁡x,y
whattype⁡x,y,z
whattype⁡2+4⁢I
complex⁡extended_numeric
whattype⁡a
a≔1:
b≔hello:
whattype⁡b
M≔rtable⁡1,2,3,4
M≔1234
whattype⁡M
N≔Matrix⁡1,2,3,4
N≔1234
whattype⁡N
q≔DEQueue⁡5,6,7
whattype⁡q
DEQueue
whattypekernel⁡q
See Also
NumericClass
operators[precedence]
type
Download Help Document