Question: How to Build a Package Module from Collected Pieces while Using Shared Helper Procedures

I am creating a largish package (i.e., for use by others with the “with” command).

Most of the exported procedures have some derivations associated with the code.  This is at least a partial reason for using Maple.  So, I had organized a worksheet so that each exported procedure has its own section that included pre-coding derivations, the procedure, and some post-coding validation of the code (serious testing is done elsewhere).  At the end of the worksheet I had a section that built the module and saved it to the appropriate library.  If I execute the worksheet it runs through everything and builds a new version of the library containing the package.

Getting these exported procedures to bind to a local helper procedure that is shared among several exported procedures was a bit tricky.  The way I ended up doing it is illustrated in the attached worksheet.

From a life cycle perspective is there a better way to think about this?



[Display, FromMathContainer, MakeInert, NoSimpl, Parse, SameStructure, ToMathContainer, ToMathML, Typeset, Value]


DistWorkSheet := proc (A, B) F(A[1]-B[1])+F(A[2]-B[2]) end proc

proc (A, B) F(A[1]-B[1])+F(A[2]-B[2]) end proc



"  export Dist"


"  option package;"


Sqr := proc (A) A*A end proc


Dist := eval(subs(F = eval(Sqr), eval(DistWorkSheet)))

"end module"




proc (A, B) (proc (A) A*A end proc)(A[1]-B[1])+(proc (A) A*A end proc)(A[2]-B[2]) end proc


Test:-Dist([0, 0], [1, 1])






Please Wait...