26
$\begingroup$

Assume that I know a package's (Context?) name that is loaded. Now I want to list the functions defined in this package. How can I do it?

I remember that I found a way once, but I cannot re-find it. I tried some combinations with ? but for vain.

$\endgroup$

3 Answers 3

24
$\begingroup$

Possibly this way:

<< PrimalityProving`

?PrimalityProving`*

or alternatively (see the copy&paste issue in the comments)

?"PrimalityProving`*"

Mathematica graphics

See also the help under ref/Information, subsection "Generalizations & Extensions". In some cases you have to provide a string argument:

Information["*Values"]

Mathematica graphics

$\endgroup$
7
  • $\begingroup$ Thanks! This is exactly what I was looking for. $\endgroup$
    – Dror
    Mar 28, 2012 at 10:48
  • 1
    $\begingroup$ In version 7 I need ?"PrimalityProving`*" (string). Is this no longer the case in v8? ` $\endgroup$
    – Mr.Wizard
    Mar 28, 2012 at 11:42
  • $\begingroup$ With 8.04 it works without quotes . I´ll add the quoted version. $\endgroup$
    – Yves Klett
    Mar 28, 2012 at 12:49
  • 3
    $\begingroup$ @Mr.Wizard this is just a copy/paste issue that arises from pasting ?PrimalityProving`* into a cell after something else. It doesn't paste correctly in 8 either but will work without the quotes in either version if pasted into a cell on its own or typed in directly. $\endgroup$ Mar 28, 2012 at 13:25
  • 2
    $\begingroup$ The above lists all the public functions. In addition, doing Context`*`* will list the functions in the `` Private `` context and other subcontexts nested one level (most packages do not go beyond that). I've found some neat helper functions that way... $\endgroup$
    – rm -rf
    Jul 29, 2012 at 5:23
16
$\begingroup$

Another possibility:

<< PrimalityProving`

Names["PrimalityProving`*"]
   {CertificateDiscriminant, CertificateK, CertificateM,
    CertificateNextPrime, CertificatePoint, CertificatePrime, fact,
    HilbertPolynomial, ModularInvariantj, PointEC, PointECQ,
    PrimeQCertificate, PrimeQCertificateCheck, ProvablePrimeQ}
$\endgroup$
1
  • 4
    $\begingroup$ Of course you'd want to use this form, with explicit mention of Names, in case you were trying to get the list of package names from within other code. $\endgroup$
    – murray
    Mar 28, 2012 at 14:56
11
$\begingroup$

I made a little interactive thing ('reportPackages') that often proves helpful. It lives in my own utilities package:

?? reportPackages

reportPackages::usage = "reportPackages produces a window with a SetterBar and a button. The SetterBar lists all currently linked Packages (from $Packages). The button produces a clickable list of exported Symbols of a selected Package. Clicking a symbolname gives its usage note if present ";

    reportPackages := 
  DynamicModule[{pakket, functies}, 
   Column[{SetterBar[Dynamic[pakket], $Packages, 
       Appearance -> "Row"], 
      Column[{Dynamic[functies = pakket <> "*"], 
        Button["info", 
         Information[Evaluate[functies], LongForm -> False]] }] }] // 
    Framed];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.