>
|
|
>
|
|
>
|
|
| (1) |
| (2) |
This module is initialized by calling the procedure startup when the module is read from a repository. It executes the procedure shutdown when the module is either garbage collected or when Maple exits.
>
|
P := module()
export e;
local T, startup, shutdown;
option load = startup, unload = shutdown;
e := proc( n::posint )
if assigned( T[ n ] ) then
T[ n ]
else
int( expr, x )
end if
end proc;
startup := proc( )
# store common values
local i, expr;
global x;
for i from 1 to 100 do
expr := sin( n * x ) * cos( n * x );
T[ expr, x ] := int( expr, x )
end do
end proc:
shutdown := proc( )
# print a message
printf("Module P is going away\n");
end proc:
end module:
|
This module has its exports protected automatically.
>
|
|
| (3) |
>
|
|
Module exports are not protected in the absence of the package option.
>
|
|
| (5) |
>
|
|