MathGroup Archive 2009

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

Search the Archive

Re: two questions

  • To: mathgroup at
  • Subject: [mg100328] Re: two questions
  • From: Szabolcs <szhorvat at>
  • Date: Mon, 1 Jun 2009 07:07:40 -0400 (EDT)
  • References: <gvtmar$gae$>

On May 31, 1:31 pm, Francisco Gutierrez <fgutiers2002 at>
> 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=
> 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.

  • Prev by Date: Re: Indexed Slot in a Rule - How to do it??
  • Next by Date: Re: treatment on C[i]
  • Previous by thread: Re: two questions
  • Next by thread: Re: two questions