Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7968 > unrolled thread
| Started by | James Stein <mathgroup@stein.org> |
|---|---|
| First post | 2012-01-18 11:01 +0000 |
| Last post | 2012-01-19 10:06 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Can the code of a function obtain the names of its arguments? James Stein <mathgroup@stein.org> - 2012-01-18 11:01 +0000
Re: Can the code of a function obtain the names of its arguments? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2012-01-19 10:06 +0000
| From | James Stein <mathgroup@stein.org> |
|---|---|
| Date | 2012-01-18 11:01 +0000 |
| Subject | Can the code of a function obtain the names of its arguments? |
| Message-ID | <jf68qh$g85$1@smc.vnet.net> |
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?)
[toc] | [next] | [standalone]
| From | "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> |
|---|---|
| Date | 2012-01-19 10:06 +0000 |
| Message-ID | <jf8pur$3ds$1@smc.vnet.net> |
| In reply to | #7968 |
On Wed, 18 Jan 2012 11:01:37 -0000, 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?)
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}]}
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web