Re: Package naming
- To: mathgroup at smc.vnet.net
- Subject: [mg24723] Re: Package naming
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 9 Aug 2000 02:31:22 -0400 (EDT)
- References: <8mdk7g$536@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jack, If you use BeginPackage["PiecewiseContinuous`"] and put the file into, with Windows C : \\ProgramFiles\\WolframResearch\\Mathematica\\4.0\\AddOns\\ExtraPackages Then <<PiecewiseContinuous` will load the package. I classify my own packags inside ExtraPackages so that, for example it might appear in haypacks\\Calculus and I would have use BeginPackage["Calculus`PiecewiseContinuous`"] To load, I would need << haypacks`Calculus`PiecewiseContinuous` If added to the search path (given by $Path) by AppendTo[$Path, "C:\\Program Files\\Wolfram Research\\Mathematica\\4.0\\AddOns\\ExtraPackages\\haypacks"] Then I would be able to load with << Calculus`PiecewiseContinuous` but then there would be a problem if, say, the StandardPackages included , a package named PiecewiseContinuous inside the folder named Calculus This problem can go on and on of course -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Jack Goldberg" <jackgold at math.lsa.umich.edu> wrote in message news:8mdk7g$536 at smc.vnet.net... > Hi once again, > > I need some help. > > I have just completed designing a package that tries to incorporate > piecewise continuous functions seamlessly into Mathematica. Naturally, I > entitle the package PiecewiseContinuous. So, I want the user > to be able to call this package by > > Needs["PiecewiseContinuous`"] > > or > > <<PiecewiseContinuous` > > just the way I can call <<Algebra` or Needs["Collatz`"] to get > these to Packages to load. (I know the difference between << and Needs; > I use them both here to illustrate my problem.) > > Now the problem ... > > What do I put as the argument of BeginPackage[?] and where should the > package be stored so that the call to load it is not too different from > <<PieceWiseContinuous` ? I have a feeling these are related questions and > the answer hinges on ContextPaths. I might > add that none of the books I have consulted directly address this issue. > (I have a rather large library of Mathematica books by the way.) For instance, > Maeder gives a host of examples in his book Programming in Mathematica. > Here is one > > BeginPackage["RandomWalk`"] > ... > > EndPackage[] > > but does not hint at where and how to store this package so that it can > be loaded with the call <<RandomWalk` . > > My best quess is this: If the user (say me) stores the package in a > folder `mypackages, then the correct call to load PiecewiseContinuous is > Needs["mypackages`PiecewiseContinuous`"] since this will tell Mathematica where > to look for this function. Is this right? > > Thanks all. Learning Mathematica on my own tends to leave me with large gaps in > my knowledge- or at least in my confidence. > > > Jacl > > > > > >