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?


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



  • Prev by Date: Re: Question about function
  • Next by Date: Re: Can the code of a function obtain the names of its arguments?
  • Previous by thread: 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?