MathGroup Archive 2012

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

Search the Archive

Re: is there internal variable like $0 in perl?


Hi Ted,

> When I define a new function myFun in a package aaa` I define a variable
> me="aaa`myFun".
>
> BeginPackage["aaa`"]
> ...
> myFun[]:=Module[{..., me="aaa`myFun"},
> ...
>
> I wonder Is there an automatic variable, like $0 in perl, which
> internally is assigned "aaa`myFun"?

no, not AFAIK. What would you use it for? If you want, you can do 
something like:

BeginPackage["aaa`"];

myPublic;

Begin["`Private`"];

myPublic[x_] := myPrivate[x];

(me : myPrivate)[x_] := (Print[me]; x^2);

End[];

EndPackage[];

then evaluating myPublic[5] will show the information you want. Without 
knowing what you actually want to achieve I feel that this is probably 
not really what you need, though...

hth,

albert



  • Prev by Date: Re: from a 2d-figure to an interactive 3d model? is it possible with mathematica?
  • Next by Date: Re: is there internal variable like $0 in perl?
  • Previous by thread: Re: how to check for NumericQ arbitrary data structure
  • Next by thread: Re: how to check for NumericQ arbitrary data structure