Re: Context Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg109422] Re: Context Problem
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Mon, 26 Apr 2010 07:32:34 -0400 (EDT)
- References: <201004260851.EAA12424@smc.vnet.net>
Hi, what about using the global symbol? BeginPackage["PackageContext`"]; Rule1::usage = "Rule1 is a test exported rule."; Begin["`Private`"]; Rule1 = Cos[Global`x_]^2 + Sin[Global`x_]^2 :> Global`x; End[]; EndPackage[]; Cheers Patrick Am Apr 26, 2010 um 10:51 AM schrieb David Park: > I would like to export rules from a package in such a way that the > pattern > symbols did not include any contexts and in which I also did not > have to > export the symbols used in the pattern. In addition, If possible, I > would > like this to work even if the package was loaded from a notebook > that had > something other than the Global` context. > > > > Here is a sample package and exported rule: > > > > BeginPackage["PackageContext`"]; > > > > Rule1::usage = "Rule1 is a test exported rule."; > > > > Begin["`Private`"]; > > > > Rule1 = Cos[x_]^2 + Sin[x_]^2 -> 1; > > > > End[]; > > > > EndPackage[]; > > > > Then, if we evaluate Rule1 we obtain a very clumsy version of the > rule, > although I suppose it will work. > > > > Rule1 > > Cos[PackageContext`Private`x_]^2 + Sin[PackageContext`Private`x_]^2 - > > 1 > > > > What I would like is the rule as written in the package. Is there a > way to > do this? > > > > > > David Park > > djmpark at comcast.net > > <http://home.comcast.net/~djmpark> http://home.comcast.net/~djmpark/ > > >
- References:
- Context Problem
- From: "David Park" <djmpark@comcast.net>
- Context Problem