MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: two questions

Hi Francisco,

Regarding your first question: the following  should do what you want,
assuming that the package has been loaded.

functionsInPackage[context_String] :=
  With[{funvalues = {DownValues, UpValues, SubValues}},
   Select[Names[context <> "*"],
     Join @@
       Map[ToExpression[sym, InputForm, #] &, funvalues] =!= {}]]];

The result is a list of names (strings). Result will depend on what you mean
by a function - my assumption was that it is any symbol that has one (or
more) of the DownValues, UpValues, SubValues defined for it. You may want to
exclude some of these properties if you need a stricter/different definition
for what constitutes a function.

Regarding the other question: check out "Programming in Mathematica" by
Roman Maeder - this is probably the best source of information on packages.
Another good discussion is in the  book of David Wagner ("Power programming
with Mathematica: the kernel"), but it is out of print. There are also some
recomendations from WRI on writing packages (one by** Todd Gayley if I am
not mistaken), they can be found on MathSource (Wolfram library archive).
Some other books also discuss them but in less detail (Paul Wellin et al,
"Introduction to programming with Mathematica", for instance).
I may also add that I have written a few packages that deal with package
construction issues such as package reloading and symbol dependencies - you
may want to check them out on my web site  <>

Hope this helps.


On Sun, May 31, 2009 at 3:32 AM, Francisco Gutierrez <fgutiers2002 at
> wrote:

> Dear list members:
> a. I made a package and I want to retrieve the functions it has. What I
> would 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
> documentation.
> b.  According to you what are the best references to study the theme of
> packages in Mathematica?
> Thanks
> Francisco

  • Prev by Date: Re: Indexed Slot in a Rule - How to do it??
  • Next by Date: Speeding up code
  • Previous by thread: Re: two questions
  • Next by thread: two questions