definition - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

Definition of a Type in Maple

Description

• 

By definition, a type in Maple is any expression that is acceptable as the second argument to the procedure type, and that, for any choice of first argument to type causes it to return either true or false. For example, in type(expr, typexpr), expr is of type typexpr if and only if the first expression evaluates to true.

• 

Any particular type belongs to one of the following four categories:

1. 

A system type: a type which is a name that is defined in the kernel of the Maple system. System types usually correspond to primitive algebraic or data structure concepts, such as integer, float, list, and relation.

2. 

A type expression which is a general Maple expression as described in type/structured.

3. 

A procedural type: When a procedure (or appliable module) has been defined which will perform the type analysis of the argument and will return true or false accordingly, this procedure can be made a type called for example abc by either assigning it to the global name `type/abc`, or by calling TypeTools:-AddType(abc, p) where p is the procedure. This procedure may be available from the global Maple environment or from a library (for the latter case it is automatically loaded into the environment).

`type/doubleprime` := n -> type(n/2, prime);

  

or equivalently,

TypeTools:-AddType(doubleprime, n -> type(n/2, prime));

....:

map(type, [4, 8], doubleprime);

  

This is one of the mechanisms to define new types in Maple. For example, monomial, algnum, and specindex are presently implemented as Maple library procedures.

4. 

An assigned type named abc can also be created from a type expression by either assigning it to the global name `type/abc`, or by calling TypeTools:-AddType(abc, t), where t is the type. The type evaluation type(foo, abc) then evaluates as type(foo, `type/abc`) would in the former case and type(foo, t) would in the latter.

`type/intargs` := [algebraic, {name,name=algebraic..algebraic}];

  

or equivalently,

TypeTools:-AddType(intargs, [algebraic, {name,name=algebraic..algebraic}]);

....:

if not type([args],intargs) then error ...;

  

The type last_name_eval is presently implemented as an assigned structured type in the library.

See Also

type

type/structured

 


Download Help Document