Packages

Hi

I am quite new to Maple and to these forums so please be gentle with explanations! I have a series of procedures which i would like to save as a package so that when i open a new worksheet i can type with (...) and all the little programs will be loaded. How do i do this?

acer's picture

module

You create a module, which you give the name you want for the package. And you give it 'option package'.

For example,

foo := module()
option package;
export f1, f2;
  f1 := proc() "stuff" end proc;
  f2 := proc() "other stuff" end proc;
end module:

with(foo);
f1();
f2();

acer

job done!

Thanks! That works great

creating an archive

You will probably want to save your module to a custom Maple archive so that you can use it from any Maple session, provided it can access that archive.  Saving the module is easy enough, assuming you have a writable directory with path /home/si37/maple:

LibraryTools:-Save('foo', "/home/si37/maple/myarchive.mla"):

The next step to modify the global variable libname so that Maple can find this archive.  I do that by creating a Maple initialization file and inserting the line

libname := "/home/si37/maple", libname:

See the Maple help page worksheet,reference,initialization for details on the location of the initialization file. Maple reads this file every time it starts and executes the Maple commands contained within.  The above assignment to libname prepends your custom archive directory to the existing libname sequence.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}