Subject: Q about arguments scoping in function definition
From: Andrey Siver
Date: Tue, 9 Oct 2007 11:02:58 +0400
Dear Stavros,
I see now that fuctional argument is differ from symbol.
Thank You for the answer.
-Andrey
----- Original Message -----
From: "Stavros Macrakis" <macrakis at alum.mit.edu>
To: "Andrey Siver" <ihep-2005 at yandex.ru>
Cc: <maxima at math.utexas.edu>
Sent: Monday, October 08, 2007 5:53 PM
Subject: Re: [Maxima] Q about arguments scoping in function definition
> 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).
>
> Function references are not resolved at definition time, but at evaluation
> time.
>
> This is all consistent with "traditional" Lisp semantics (pre-Scheme,
> pre-Common Lisp).
>
> If you want to use a functional argument, use apply to avoid this problem,
> e.g.
>
> t(n, f, x) := apply(f, [n+x]);
>
> -s