Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7993 > unrolled thread

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

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-01-19 10:09 +0000
Last post2012-01-19 10:09 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Can the code of a function obtain the names of its arguments? Bob Hanlon <hanlonr357@gmail.com> - 2012-01-19 10:09 +0000

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

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-01-19 10:09 +0000
SubjectRe: Can the code of a function obtain the names of its arguments?
Message-ID<jf8q3v$3gu$1@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@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web