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

Online Help

All Products    Maple    MapleSim


type/module

check for a module

type/record

check for a record

 

Calling Sequence

Parameters

Description

Subtypes

Supertypes

Examples

Calling Sequence

type(expr, '`module`')

type(expr, '`module`'(e1, e2, ..., en))

type(expr, 'record')

type(expr, 'record'(e1, e2, ..., en))

Parameters

expr

-

any expression

ei

-

names of expected exports

Description

• 

The command type(expr, '`module`') returns true if expr is of type module. Otherwise, false is returned.

  

Expressions of type module are created as a result of evaluating a module definition.

• 

When called with optional arguments ei (i=1..n), the command returns true if, in addition to being of type module, the module e exports members named e1, e2, ..., en. It is not required that e1, e2, ..., en name all the exports of the module, only that each among them appears as an export. (Note carefully the type and placement of quotes in the Examples section below.)

• 

The optional exports ei can be either symbols or expressions of the form symbol :: type. If a type specifier appears, then the module expr must export the given name with an assigned value of the given type. For instance, the type `module`( x :: posint ) describes a module with an export named x currently assigned a value of type posint.

• 

The first optional export, e1, can also be a string. In that case, the module expr must be a named module whose name matches (textually) e1.

• 

Note: Because the name module is a Maple keyword, it must be enclosed in back quotes when used as an argument to type. Failure to do so results in a syntax error.

• 

The type record is identical to type module, except that it recognizes modules that are records, returning false for modules that are not records. (See Record.)

Subtypes

• 

type/object

Supertypes

• 

type/atomic

Examples

typeLinearAlgebra,`module`

true

(1)

typemoduleend module,`module`

true

(2)

type'moduleend module',`module`

false

(3)

type2,`module`

false

(4)

typesin,`module`

false

(5)

mmodule_exporte1,e2end module:

typem,`module`

true

(6)

typem,`module`e1

true

(7)

typem,`module`e2

true

(8)

typem,`module`e1,e2

true

(9)

typem,`module`e1,e2,e3

false

(10)

qSimpleQueue:

typeq,`module`enqueue,dequeue

true

(11)

typem,record

false

(12)

rRecorda=2,b=3

rRecorda=2,b=3

(13)

typer,`module`

true

(14)

typer,record

true

(15)

typer,recorda,b

true

(16)

typer,recorda::integer,b

true

(17)

typer,recorda::integer,b::float

false

(18)

p := proc(x) local XYZ; module XYZ() export a; end module; XYZ:-a := x; XYZ end proc:

m1p2

m1moduleXYZexporta;end module

(19)

m2p3.5

m2moduleXYZexporta;end module

(20)

typem1,`module`a::integer

true

(21)

typem1,`module`XYZ

true

(22)

typem1,`module`XYZ,a::integer

true

(23)

typem2,`module`XYZ

true

(24)

typem2,`module`XYZ,a::integer

false

(25)

See Also

module

Record

type

type/moduledefinition