Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Context Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109417] Context Problem
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 26 Apr 2010 04:51:12 -0400 (EDT)

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/  

 


  • Prev by Date: Re: Kernel crash, version 7.0, windows XP, when using slider in Manipulate with Dynamics plot on control area
  • Next by Date: Re: problems with NMinimize
  • Previous by thread: Re: Kernel crash, version 7.0, windows XP, when using slider in Manipulate
  • Next by thread: Re: Context Problem