[Maxima] green's functions, passing functions to a routine
pdl at johnlapeyre.com
Sun Sep 7 21:35:52 CDT 2008
> Maxima is inconsistent about whether or not to evaluate the name
> of a function. If f is already the name of a function, then f is not
> evaluated in the expression f(t); but it is evaluated otherwise.
> I'm going to guess that you have a function named f somewhere
> in your program. An easy workaround is to name the formal argument
> something obscure like f% or whatever.
I have been looking for an at least quasi-robust solution that doesn't
involve choosing ugly function names. Using apply rather than
a function call seems to protect against premature evaluation...
fold(f,x,v) := block([res],
for a in rest(v,1) do
Then I can do this and it works.
(%i26) f(x) := x$
If instead I call f like f(res,a) in fold, rather than using
apply, then I get :
Too many arguments supplied to f(x):...
because it is trying to call f(x):=x
I have been trying various combinations of single and
double quotes, eg,
fold('f,x,v) := ...,
but I have not found another solution.
More information about the Maxima