MathGroup Archive 2013

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

Search the Archive

Re: basic namespace question, and access to BinarySearch


On 2013-09-11 07:44:25 +0000, Itai Seggev said:

> On Tue, Sep 10, 2013 at 03:33:47AM -0400, Alan wrote:
>> What is the proper way to get access to a package without adding that
>> package to $ContextPath?  If I use Needs, the package name is added to
>> $ContextPath.  (Of course I can remove items from $ContextPath.)
> 
> The short answer is there really isn't.
> 
> In[26]:= BeginPackage["foo`"]
> 
> In[29]:= EndPackage[]
> 
> In[30]:= $ContextPath
> 
> Out[30]= {"foo`", "DocuTools`", "InflationAdjust`", "FormulaData`", \
> "QuantityUnits`", "WebServices`", "System`", "Global`"}
> 
> The moment the package loads it will be added to $ContextPath.

I wouldn't say that there isn't a wayâ?¦

Here's a link to the same question on Mathematica.SE (and the answer I like):

http://mathematica.stackexchange.com/a/5574/12

Block[{$ContextPath},  Needs["Combinatorica`"]]

I always load Combinatorica like this in version 8 and later.

I should note here that if you use the ToCombinatoricaGraph function 
from the GraphUtilities package, it'll force-add Combinarotica` to the 
context path.  I did point out how this is rather inconvenient to 
support at wolfram.com, but it wasn't fixed.




  • Prev by Date: Re: producing a noise
  • Next by Date: Re: producing a noise
  • Previous by thread: Re: basic namespace question, and access to BinarySearch
  • Next by thread: Re: basic namespace question, and access to BinarySearch