"Delayed" problem in mfunction/mmacro definition



----- Original Message ----- 
From: "Albert Reiner" <areiner at tph>
To: "Siver Andrey" <siver@sirius.ihep.su>
Cc: "Maxima-List" <maxima@math.utexas.edu>
Sent: Sunday, November 14, 2004 5:44 PM
Subject: Re: [Maxima] "Delayed" problem in mfunction/mmacro definition


> ["Siver Andrey" <siver@sirius.ihep.su>, Sun, 14 Nov 2004 13:07:51 +0300]:
> > (%i3) F3(x)::='(x);
> > (%o3)      F3(x) ::= 'x
> > (%i4) F3(y);
> > (%o4)            x
> > (should be 'y' instead)
>
> ,----
> | (%i1) F5(x) ::= buildq([x], 'x);
> |
> | (%o1)                      F5(x) ::= BUILDQ([x], 'x)
> | (%i2) F5(y);
> |
> | (%o2)                                  y
> `----

Thank you for the example.

> > This is important question for definition of Mathematica ":="
> > (SetDelayed) function for MAXIMA (I thought that 'SetDelayed' could
> > be interpreted as (MDEFINE) (or (MDEFMACRO)) but with second
> > argument (MQUOTE)ed and with first argument 'a' --> (MEVAL a) at the
> > evaluation time BUT found it's not a case).
>
> If you only want to do something like
>     f[x_] := Sin[x]
> so that
>     f[2] --> Sin[2]
>     f[1+1] --> Sin[2]
> , you can simply use Maxima's ":=" which already does the right thing;
> if you want the right hand side to be evaluated (as with Set) you have
> to explicitly ask for that with, e.g., ''.

What do you mean by ''?

I need to realize Mathematica's:
*** ex.1 ***
a=1;
f := a + 1;
f
=> 2
a=2;
f
=> 3
*** ex.2 ***
a=1;
f = a + 1;
f
=> 2
a=2;
f
=> 2
***
and the same things for functions under MAXIMA. You are right, MAXIMA's ":="
looks like 'SetDelayed' for functions.

How to see what exactly the expressions does MAXIMA keep for a symbol or a
function?

>
> HTH,
>
> Albert.
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>