Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: functions, packages, and contexts

  • To: mathgroup at
  • Subject: [mg25036] Re: functions, packages, and contexts
  • From: quizzik at (Thomas Anderson)
  • Date: Fri, 1 Sep 2000 21:57:42 -0400 (EDT)
  • Organization: Stanford University
  • References: <8one3u$>
  • Sender: owner-wri-mathgroup at

<< question of how to use packages within other packages >>

This is something that gave me a lot of trouble, too. The problem is
when you declare the package using BeginPackage["x`"], the only
contexts that
are available on the search path are x`, Global` and System`. You want
call other packages; the easiest way to do this is to provide these
as a second argument to BeginPackage. 

For example, BeginPackage["x`", {"y`", "z`"}] will begin the "x`"
context, and also put y` and z` on the search path. Then you can use
symbols defined in y` and z` without worrying about the context. There
a reasonably clear explanation of all this in section 2.6.10 of the
Mathematica Book.

Incidentally, the Mathematica Book indicates that the additional
to be used must be given as a List. In my experience, however, this
seem to be necessary; i.e. BeginPackage["x`", "y`", "z`"] seems to work

just fine. Perhaps someone with more expertise can comment on this.


  • Prev by Date: Re: ListPlot
  • Next by Date: Re: MatrixReplace.m
  • Previous by thread: functions, packages, and contexts
  • Next by thread: RE: functions, packages, and contexts