Recently, working on Nested Verification, I took a look at the whattype procedure. First, I couldn't find any use of local variables t1, t2, L, k1, k2 declared in it. That seems odd. Second, the order of types in it seems to be not exactly right. In particular, symbol is located earlier than `module`. Also, some types are missing, record for example. That leads to not recognizing modules and records,
r := Record( 'a', 'b' ):
m := module() end:
whattype(r);
                                symbol
whattype(m);
                                symbol
Similarly to the compact and efficient version of Nested Verification, I wrote a "compact and efficient" version of whattype,
wtype:=proc(a) 
local t;
if nargs <> 1 then return 'exprseq' fi;
for t in ['`+`','`*`','`||`','string','indexed','integer',
'fraction','`^`','function','series','SDMPolynom','float',
'extended_numeric','complex'('extended_numeric'),'hfarray',
'assignment','Vector[row]','Vector[column]','Matrix','Array',
'array','table','set','list','`=`','`..`','`<>`','`<`','`<=`',
'`and`','`or`','`xor`','`implies`','`not`','procedure','`::`',
'uneval','record','`module`','moduledefinition','zppoly',
'symbol','unknown']
do if a::t then break fi od;
t end:
I used the same order of types as in whattype except moving symbol to the end and adding record in front of module. That made records and modules recognizable,
wtype(r);
                                record
wtype(m);
                                module
A lot of types are still missing, but they can be easily added if necessary.

Please Wait...