MathGroup Archive 1992

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

Search the Archive

Seeing variables outside of Packages.

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Seeing variables outside of Packages.
  • From: Scott Herod <sherod at picard.colorado.edu>
  • Date: Thu, 19 Nov 92 15:40:32 MST

 I want to write a package that will define a variable and some
functions and let the user operate on the variable using the
functions in the package.  An example might be:

(******************************)
BeginPackage["MyPackage`"]

tnirP::usage = "Look at it yourself!"

Begin["`Private`"]

    f = myname;

    tnirP[f_] := Print[f];

End[]

EndPackage[]
(******************************)

What I want to be able to do is:

->Mathematica 2.0 for SPARC
->Copyright 1988-91 Wolfram Research, Inc.
->-- X11 windows graphics initialized --

->In[1]:= <<test.m

->In[2]:= tnirP[f]In[2]:= tnirP[f]
->f

But the output is not that wanted instead you must do:

->In[3]:= tnirP[MyPackage`Private`f]
->MyPackage`Private`myname

Again not exactly the output wanted appears.
Is there some way to have

->In[2]:= tnirP[f]

return

->myname


Scott Herod
Applied Mathematics
University of Colorado, Boulder
(sherod at newton.colorado.edu)






  • Prev by Date: Math typesetting in plot labels
  • Next by Date: LIst of BUGS ?
  • Previous by thread: Re: Math typesetting in plot labels
  • Next by thread: LIst of BUGS ?