ToString
ToString has several options that I won't address here because I never became
familiar with them. However, there is an interesting problem with converting
a symbol to a string. How can we convert a symbol to a string without
letting the symbol evaluate? ToString2 below does the job. Notice evaluation
has to be prevented in two places here.
In the next cell we get the characters used to make the Symbol mass without
letting the symbol evaluate.
mass
Sometimes you might want a function to convert one of it's arguments to a
string before the argument evaluates. Then you might want your function to do
something with the resulting string. In this case a pure function can be used
to do the string conversion. The next cell defines a function Letters that
returns the characters used to make the argument before the argument has a
chance to evaluate.
Notice mass still has the value that was assigned above.
Created by Mathematica (May 16, 2004)