[Maxima] Variables in function definition problem
praimon at gmail.com
Tue Jun 26 10:04:54 CDT 2007
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:
(%o5) g(h, [a, f])
The result is correct even though the 'f' fed to the new function was
used in its original definition.
However, here's function I created that takes an arbitrary function
and list of lists and does an outermap operation on them:
(%o7) [[h(c, e), h(c, h)], [h(d, e), h(d, h)]]
This result is wrong. The function seems to 'remember' that I used 'f'
in the original definition and is getting confused. If I explicity
declare 'f' as a local variable it works as expected:
(%o9) [[f(c, e), f(c, f)], [f(d, e), f(d, f)]]
...but I would never have thought that I needed to do that. And I
haven't been doing it in the course of my functions definitions, so
now I wonder how many of those functions are in similar danger. Am I
misunderstanding something or is there some idiosyncrasy in the
definition I used?
More information about the Maxima