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: [mg15464] Re: getting the name of a symbol
  • From: jpeccoud at ee.washington.edu (Jean Peccoud)
  • Date: Mon, 18 Jan 1999 04:22:07 -0500
  • Organization: University of Washington
  • References: <77jjc1$2lf@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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/


-- 

Andrew

One way of doing it might be to keep the function name as a string using
SymbolName. But since you mentionned this option, it is possible that
it does not fit your needs. 

MyFunction[x_]:=2x
FunctionNameAnalysis[f_Symbol]:=Characters[SymbolName[f]]

In[18]:=
FunctionNameAnalysis[MyFunction]

Out[18]=
{"M","y","F","u","n","c","t","i","o","n"} _________________
Emmanuel Peccoud
e-Notebooks Ltd.
Visit our web site at www.e-notebooks.com


  • Prev by Date: Re: MapleConverter
  • Next by Date: using FindMinimum to minimize a function involving NIntegrate
  • Previous by thread: Re: getting the name of a symbol
  • Next by thread: Re: getting the name of a symbol