CoCoA:Type

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Type

the data type of an expression

Description

This function returns the data type of E. The function <ttref>Types</ttref>

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,<quotes>a</quotes>,2,<quotes>b</quotes>,3,<quotes>c</quotes>]);
[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(<quotes/>),
FUNCTION]
-------------------------------

Syntax

Type(E:OBJECT):TYPE

Data Types

Types

   <type>type</type>