assignment operator and function definition



The body of a named function definition is not evaluated; it is not
even simplified.
Same goes for the body of a lambda expression.

define(f(x), FOO) evaluates FOO and makes that the body of f.
Or f(x) := ''(FOO) evaluates FOO and pastes that into the place of ''(FOO).
Note that '' is processed only the first time it is parsed.
So if you want to evaluate the function body in a script,
use define.

HTH, Robert Dodier

On 5/28/11, Ether Jones <maxima at etherjones.us> wrote:
>
> I'm still struggling to understand how to use the assignment operator ":"
> properly.
>
> Why does the following not give y(x) := x^2 + x - 1 ?
>
> Maxima 5.22.1 http://maxima.sourceforge.net
> using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
>
> (%i1)
> kill(all);
> ex1: x^2;
> ex2: x -1;
> y(x):=ex1+ex2;
>
> (%o0)                                done
> (%i1)
>                                        2
> (%o1)                                 x
> (%i2)
> (%o2)                                x - 1
> (%i3)
> (%o3)                          y(x) := ex1 + ex2
> (%i4)
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>