MathGroup Archive 2012

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

Search the Archive

Re: Can the code of a function obtain the names of its arguments?


On Wed, 18 Jan 2012 11:01:37 -0000, James Stein <mathgroup at stein.org>  
wrote:

> I fear the answer is no, because I suspect that once values are bound to
> the names, there might seem to be scant use in keeping the names around.
>
> But I have a little debugging routine in mind I'd like to implement, so  
> I'm
> hoping the answer is yes. (And if yes, how?)

names[args___] := HoldForm /@ Unevaluated[{args}];
SetAttributes[names, HoldAll];

In :=
a = 1; b = 2;
names[a, b, {a, b}]

Out =
{HoldForm[a], HoldForm[b], HoldForm[{a, b}]}



  • Prev by Date: Tips for writing correct, non trivial Mathematica Libraries
  • Next by Date: Re: Question about function
  • Previous by thread: Re: Can the code of a function obtain the names of its arguments?
  • Next by thread: Re: Can the code of a function obtain the names of its arguments?