Re: Extracting the name of a variable

• To: mathgroup at smc.vnet.net
• Subject: [mg26943] Re: Extracting the name of a variable
• From: Mike Yukish <may106 at psu.edu>
• Date: Sat, 27 Jan 2001 20:00:10 -0500 (EST)
• Organization: Penn State University, Center for Academic Computing
• References: <94tl4s\$lck@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"Ersek, Ted R" wrote:

> Mike Yukish asked how one can take a variable which has a value assigned and
> convert it to a string without letting it evaluate.
>
> I provide the solution in the section for (ToString) on my web site.  The
> URL is
> http://www.verbeia.com/mathematica/tips/Tricks.html

Many thanks to all who replied. I posed my problem as a subpart of a more
complex problem, which still defeats me. I had hoped to Map[ ] the function
extractName over a list, and extract the names of all the variables in the list.
Ted has identified its difficulties, which I offer up here.

Problem: Create a function that takes a list of variables, and extracts the
symbol name of each. This is an added level over the initial problem.

q=4
z=5

list1={q,z,w}

extractNamesFromList[list1]

out[]:=

{"q","z","w"}

Ted Ersek and Bob Hanlon have both shown me how to create a function that will
work with

extractNamesFromList[{q,z,w}]

out[]:=
{"q","z","w"}

but  extractNamesFromList[list1]
out[]:=
"list1"

So passing a predeclared list is a different story, and Ted pointed that out. I
think I can live with the restriction, though.

```

• Prev by Date: Re: Multiply 2 Lists together in a certain way
• Next by Date: Re: Multiply 2 Lists together in a certain way
• Previous by thread: Re: Extracting the name of a variable
• Next by thread: Re: Re: Extracting the name of a variable