12.4.5 Using strings as names: make_symbol
Variable and function names are symbols, namely sequences of
characters, which are different from strings. For example, you can
have a variable named abc, but not "abc".
The make_symbol command turns a string into a symbol; for example
make_symbol("abc") is the symbol abc.
Examples.
-
Input:
a:= "abc"; |
make_symbol(a):= 3
|
or:
make_symbol("abc"):= 3
then:
abc
Output:
The variable abc will have the value 3.
- Similarly for functions.
Input:
b:= "sin"; |
make_symbol(b)(pi/4)
|
or:
make_symbol("sin")(pi/4)
Output:
which is sin(pi/4).