5.26 write a text file that contains a package, and load it

This shows how to do a simple package and use it without building a library. Just using a plain text file.

Create this nma_pkg1.txt file:

 
nma_pkg1 := module() 
  export f1; 
  option package; 
 
  f1:= proc() 
       print("in pakcage nma_pkg1"); 
  end proc; 
 
end module;
 

now save it, and from maple do

>read("c:\\nma_pkg1.txt");
 

now execute f1() as this:

>nma_pkg1[f1](); 
          "in pakcage nma_pkg1"
                                                                                  
                                                                                  
 

now put it in a library (so that we can use with, instead of read)

> savelibname:=("c:/maple"); 
> march('create', savelibname, 20); 
> savelib(nma_pkg1); 
>restart; 
> libname := "c:/maple",libname; 
> with(nma_pkg1); 
> f1(); 
    "in pakcage nma_pkg1"
 

now make changes to the nma_pkg1.txt file and updated again as above.