type/module
check for a module
type/record
check for a record
Calling Sequence
Parameters
Description
Subtypes
Supertypes
Examples
type(expr, '`module`')
type(expr, '`module`'(e1, e2, ..., en))
type(expr, 'record')
type(expr, 'record'(e1, e2, ..., en))
expr
-
any expression
ei
names of expected exports
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.)
type/object
type/atomic
type⁡LinearAlgebra,`module`
true
type⁡moduleend module,`module`
type⁡'moduleend module',`module`
false
type⁡2,`module`
type⁡sin,`module`
m ≔ module_export⁡e1,e2end module:
type⁡m,`module`
type⁡m,`module`⁡e1
type⁡m,`module`⁡e2
type⁡m,`module`⁡e1,e2
type⁡m,`module`⁡e1,e2,e3
q≔SimpleQueue⁡:
type⁡q,`module`⁡enqueue,dequeue
type⁡m,record
r≔Record⁡a=2,b=3
type⁡r,`module`
type⁡r,record
type⁡r,record⁡a,b
type⁡r,record⁡a::integer,b
type⁡r,record⁡a::integer,b::float
p := proc(x) local XYZ; module XYZ() export a; end module; XYZ:-a := x; XYZ end proc:
m1≔p⁡2
m1 ≔ moduleXYZexporta;end module
m2≔p⁡3.5
m2 ≔ moduleXYZexporta;end module
type⁡m1,`module`⁡a::integer
type⁡m1,`module`⁡XYZ
type⁡m1,`module`⁡XYZ,a::integer
type⁡m2,`module`⁡XYZ
type⁡m2,`module`⁡XYZ,a::integer
See Also
module
Record
type
type/moduledefinition
Download Help Document