MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: getting the name of a symbol

  • To: mathgroup at
  • Subject: [mg15449] Re: getting the name of a symbol
  • From: "Allan Hayes" <hay at>
  • Date: Mon, 18 Jan 1999 04:21:50 -0500
  • References: <77jjc1$>
  • Sender: owner-wri-mathgroup at

Andrew Watson wrote in message <77jjc1$2lf at>...
>Dear Matherati,
>I have a problem for which there must be a simple solution.
>Within a function
>f[a_] := blah blah blah
>I want to make use of the name of the symbol supplied as input to the
>For example, if called as
>I want to get the string "qxyz". I have looked at HoldForm and
>SymbolName but nothing yet discovered seems to do the trick.
>Andrew B. Watson
>MS 262-2
>NASA Ames Research Center
>Moffett Field, CA 94035-1000
>(650) 604-5419 (650) 604-0255 fax
>abwatson at


Here are some experiments that may  help:

Set up the situation
f[a_] := blah

Unevaluated[f[s]]/.HoldPattern[f[x_]]:> SymbolName[Unevaluated[x]]


Unevaluated[f[s]]/._[x_]:> SymbolName[Unevaluated[x]]




We can get get functions from these to do the trick: for example

Function[y, Unevaluated[y]/._[x_]:> SymbolName[Unevaluated[x]],



Allan Hayes
Mathematica Training and Consulting
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Animated 3D problem: all frames show up.
  • Next by Date: ? scatterplots with differently sized labels and dots ?
  • Previous by thread: Re: getting the name of a symbol
  • Next by thread: Re: getting the name of a symbol