Question: Procedure evaluation in packages

Hello,

I have created a module which implements several high-level procedures. Each of these call low-level procedures which are - in principle - of no interest to the end user.

Now, when I use the "module:-function()" syntax, everything seems OK. However, when I write this module as a package, using "savelib", and I try loading it back, and using it, the low-level procedures are returned unevaluated. Which obviously is not what I want...

Is there a way to force this evaluation?

Hereafter a trivial example to show what I mean. The idea is to hide "myCos" by not exporting it. But it does not change anything for the problem I am facing.

Regards,

 

 

restart;
savelibname := `z:/entreprise/pwe/Maple/Voronoi`;
                       z:/entreprise/pwe/Maple/Voronoi
###############################################################################################


myTest:= module();
export myFunc, myCos;

option package;

myCos:=proc(x);
local val;
val := 1.-x^2/(2.);
return val;
end proc:


myFunc:= proc(x);
local val;
val := (1-myCos(x))/(1+myCos(x));
return val;
end proc:

end module;
         module () export myFunc, myCos; option package; end module


savelib(myTest);


myTest:-myFunc(.1);
                               0.002506265664
myTest:-myCos(.1);
                                0.9950000000
##############################################################################################
restart;
libname := libname, `z:/entreprise/pwe/Maple/Voronoi`;
     "C:\Program Files\Maple 12/lib", "z:/entreprise/pwe/Maple/Voronoi"


with(myTest);
                               [myCos, myFunc]


myFunc(.1);
                               1 - myCos(0.1)
                               --------------
                               1 + myCos(0.1)

 

 

Please Wait...