Subject: Q about arguments scoping in function definition
From: Robert Dodier
Date: Mon, 8 Oct 2007 08:46:25 -0600
On 10/8/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> In the Maxima language, the f in f(x) is evaluated as follows:
> 1) If it is a lambda expression, apply it.
> 2) If it is a symbol, then
> a) if it is a built-in function, apply it
> a) if it has a ":=" value, substitute that and go back to (1)
> b) if it has a ":" value or binding, substitute that and go back to (1)
> 3) Consider f to be a formal function, and just simplify the expression f(x).
It seems like results would be more predictable if (2b) were moved
ahead of the other two (2a) items. As it stands, if a symbol is bound
to something other than itself, sometimes that binding is used in a
function call and sometimes it isn't.
It seems unlikely that there is code which depends on the existing
policy, as stated above, so it might be safe to modify it.
Of course we would want to test such a change.
best
Robert