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

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?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124408] Re: Can the code of a function obtain the names of its arguments?
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Thu, 19 Jan 2012 05:05:44 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jf68qh$g85$1@smc.vnet.net>

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?