On 6/26/07, praimon <praimon at gmail.com> wrote:
>
> It seems to me that the variables I use on the left-hand side of a
> function definition should be irrelevant. And so it is here:
Your particular problem comes from a problem in the evaluator which I
consider to be a bug. And I believe we can fix it. In general, however,
Maxima's current semantics (dynamic scope) will lead to other situations
where the names of variables do matter.
Here is a simpler example of your problem:
(v1:'v2,v2:'v3,v3:'v4)$
f(v1) => f(v2) correct
apply(f,[v1]) => f(v2) correct
apply('apply,[f,[v1]]) => f(v3) Why?
For those who care about the internals, the problem is that apply is an
mfexpr* (mspec) and evaluates its own arguments, but "apply" uses "eval" on
mfexpr*'s, ending up re-evaluating arguments. I don't know why apply and
outermap need to be mfexpr*s at all, since they evaluate their arguments
normally. It looks as though we can change that and avoid apply's
weirdness.
-s