Re: two questions
- To: mathgroup at smc.vnet.net
- Subject: [mg100328] Re: two questions
- From: Szabolcs <szhorvat at gmail.com>
- Date: Mon, 1 Jun 2009 07:07:40 -0400 (EDT)
- References: <email@example.com>
On May 31, 1:31 pm, Francisco Gutierrez <fgutiers2002 at yahoo.com> wrote: > Dear list members: > > a. I made a package and I want to retrieve the functions it has. What I w= ould want is: > Command[mypackage] > Output: functions for the user contained in myg package > > How can I do this? Somehow, I have failed to find this in the documentati= on. > > b. According to you what are the best references to study the theme of= packages in Mathematica? If you followed the usual way of constructing the package, then all the public symbols of the package (and *only* the public symbols of the package) will be in a context associated with it. Thus Names["MyPackagesContext`*"] is going to return a list of the names of the symbols in the package. (?MyPackagesContext`* is probably more convenient for a user of the package.) Take a look at how some of the standard packages are organized. First comes BeginPackage["MyPackage`"], then all the symbols (and only those symbols) that are to be exported by the package are mentioned (usually in the form of usage message definitions), then comes a Begin ["`Private`"] followed by the actual definitions of the functions. This structure ensures that the symbols that are meant for public use are part of MyPackage` and the rest of the symbols used in the function definitions are private.