save expressions to a Maple repository
savelib(name1, name2, ...)
savelib(name1, name2, ..., filename)
name1, name2, ...
names of expressions to be saved
repository file name
Use the savelib command to save Maple expressions in a Maple repository. Procedures, modules, tables, and all other Maple data structures are saved in a .mla repository. Both the value and name are saved so that the assignment name := value can be retrieved in a later Maple session. After a name/value pair is saved to a library, the assignment name := value is automatically performed when the corresponding library is found in the library search path specified by libname.
All access to a Maple repository is via named expressions (that is, expressions assigned to names). Any Maple expression that is to be saved must be assigned to a name, and the name used in the call to savelib. Both the name and its assigned value are saved in the repository. For example, savelib( 2 ) is invalid, but t := 2; savelib( 't' ); saves the expression 2 under the name t. Note that single uneval quotes are used around the parameter t in this example so that evaluation is delayed and the savelib command recognizes 't' instead of 2. Without these quotes, you will get an invalid input error indicating that, "savelib expects its 1st argument to be of type symbol, but received 2".
The file extension .mla is used to denote a Maple repository file. In early versions of Maple, a repository was a pair of files named with .lib and .ind extensions. A repository is identified by specifying the full path of its .lib or .mla file. (For more information, see libname.) Specifying only a directory name identifies all repositories in the directory, of which the first writable repository will be used for saving.
If the .mla file specified by the filename parameter does not exist, it will be created using the command march(create,filename). If attempting to save to the specified file fails, an error will occur (that is, it will not fall-back to savelibname or libname).
You can also use the savelib command to save Maple expressions inside of a Maple workbook (.maple). In this case the workbook functions as a repository, similar to an .mla file.
If the filename option is not used as the last argument in the call to savelib, one of the global variables savelibname or libname is used to determine the repository in which the expressions are saved. libname is only used if savelibname is not assigned. savelibname can be set to a string denoting the full path to a .mla file, or a string denoting the directory in which a .mla file exists, or, it can be a sequence of strings naming .mla files or directories.
For each directory in [savelibname] (or in [libname] if savelibname is not assigned), savelib attempts to open a Maple repository, for writing in the directory. If it is successful, it saves the values of name1, name2, ... and returns NULL. An error is raised if no repository in savelibname (or libname) can be opened for writing (for example, all the repositories are READONLY).
It is not recommended that you save to .mla files that are included with a Maple installation. It is also not recommended that you save common names like x to a repository. You may be surprised later in a subsequent session when x already has a value.
A repository can be written to only if it has a WRITABLE attribute. An attempt to write to a repository with a READONLY attribute raises an error. The WRITABLE and READONLY attributes of an archive can be examined and changed by using LibraryTools[WriteMode].
The savelib command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Save a value and a procedure to "mylib.mla" in the current directory.
sample_worker := proc(c) c+25 end proc:
Save a value and a procedure to "mylib.mla" in a specified directory.
Error, archive data file "/home/build/mylib.mla" could not be created
In order for saved variables in the repository to retain the saved value in subsequent sessions, the path to the new library needs to be appended to libname. It may also be beneficial to add the following line to an initialization file.
Download Help Document
What kind of issue would you like to report? (Optional)