MathGroup Archive 1999

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

Search the Archive

Re: getting the name of a symbol

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15437] Re: [mg15412] getting the name of a symbol
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Mon, 18 Jan 1999 04:21:42 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

I am not quite sure if I have understood  perfecly what you would like
to do but I hope the following example will be helpful:

In[1]:=
SetAttributes[myf, HoldFirst]
In[2]:= myf[x_Symbol] := HoldForm[x] == x^2

In[3]:=
x = 2;
In[4]:=
myf[x]
Out[4]=
x == 4

If you want to get a string as your final output you can, of course,
define  myf[x_Symbol] := ToString[HoldForm[x] == x^2]

On Wed, Jan 13, 1999, Andrew Watson <abwatson at mail.arc.nasa.gov> wrote:

>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
>function.
>
>For example, if called as
>
>f[qxyz]
>
>I want to get the string "qxyz". I have looked at HoldForm and
>SymbolName but nothing yet discovered seems to do the trick.
>
>Regards,
>
>
>Andrew B. Watson
>MS 262-2
>NASA Ames Research Center
>Moffett Field, CA 94035-1000
>(650) 604-5419	(650) 604-0255 fax
>abwatson at mail.arc.nasa.gov	http://vision.arc.nasa.gov/


Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp/
http://eri2.tuins.ac.jp/



  • Prev by Date: Symbolic Derivative of Piecewise Contin Fcn
  • Next by Date: Re: Re: Strange results
  • Previous by thread: getting the name of a symbol
  • Next by thread: Re: getting the name of a symbol