How to assign the name of a variable to another variable inside a function



2010/9/10 Stavros Macrakis <macrakis at alum.mit.edu>:
> Maxima normally passes arguments by value, so the expression used to
> calculate the value is not available to the function.
> Maxima does support unevaluated arguments, but it is in general a bad idea
> to use them except for very special cases. ?<<<I do not recommend it.>>>
> Example:
> f('expr) := [expr,ev(expr)]$
> x:7$
> f(x+3);
> [x + 3, 10]
> In general, it is much better practice to explicitly pass any names you want
> to use, e.g.
> f1(name,expr) := print("the value of",name,"is",expr)$
> f1('x,x)$
> the value of x is 3
> ?? ? ? ? ? -s

Thank you for your explanation. Well, this was not a real necessity,
it was just to have a better output. I think I will directly pass to
the function the name of the variable.

Stefano