Subject: dynamically created symbol -- Good Thing To Do?
From: Richard Fateman
Date: Thu, 28 Jun 2012 08:17:16 -0700
On 6/28/2012 7:24 AM, Bill Wood wrote:
> Is the ability to create named
> variables at run time one of the facilities that make maxima scripting
> really shine, or is it a dubious practice here as well?
foo[1],foo[2], etc often works.
So it possibly avoidable.
There are legitimate needs to create new names in macro definitions to
avoid name conflicts, but that is not the issue here. This occurs
in, for example, Lisp, justifying the existence of (gensym).
There are needs to create new SYMBOLIC names from time to time
e.g. constants of integration cannot ALL be "+ C" for some
constant C. So you can use C1, C2, ... but then
you could also use C[1], C[2], ..
These are not exactly new variables though. They are symbols.
However, I agree that the truly responsive answer to the
question should delve deeper into the question and ask
why it is being asked.
RJF