Re: Can the code of a function obtain the names of its arguments?
- To: mathgroup at smc.vnet.net
- Subject: [mg124413] Re: Can the code of a function obtain the names of its arguments?
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Thu, 19 Jan 2012 05:07:31 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201201181059.FAA16568@smc.vnet.net>
Use the attribute HoldAll
SetAttributes[f,HoldAll];
f[x_,y_,z_]:=Module[
{arg={HoldForm[x],HoldForm[y],HoldForm[z]}},
Thread[arg->{x,y,z}]];
a=1;b=2;c=3;
f[a,b,c]
{a->1,b->2,c->3}
Bob Hanlon
On Wed, Jan 18, 2012 at 5:59 AM, 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?)
--
Bob Hanlon
- References:
- Can the code of a function obtain the names of its arguments?
- From: James Stein <mathgroup@stein.org>
- Can the code of a function obtain the names of its arguments?