Re: basic namespace question, and access to BinarySearch
- To: mathgroup at smc.vnet.net
- Subject: [mg131620] Re: basic namespace question, and access to BinarySearch
- From: Szabolcs HorvÃt <szhorvat at gmail.com>
- Date: Thu, 12 Sep 2013 02:26:05 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <l0mhe8$ld8$1@smc.vnet.net> <l0p70p$s2d$1@smc.vnet.net>
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.