up previous next

Type

Syntax

Type(E:OBJECT):TYPE
    

Summary

the data type of an expression

Description

This function returns the data type of E. The function Types returns the list of CoCoA data types.

example

    
Define CollectInts(L)
  Result := [];
  Foreach X In L Do
    If Type(X) = INT Then Append(Result,X) EndIf
  EndForeach;
  Return Result
EndDefine;

CollectInts([1,"a",2,"b",3,"c"]);
[1, 2, 3]
-------------------------------
Type(Type(INT));  -- Type returns a value of type TYPE
TYPE
-------------------------------
Types();
[NULL, BOOL, STRING, TYPE, ERROR, RECORD, DEVICE, INT, RAT, ZMOD,
POLY, RATFUN, VECTOR, IDEAL, MODULE, MAT, LIST, RING, TAGGED(""),
FUNCTION] 
-------------------------------
        
    

See Also