Subject: get name of variable as string in function?
From: Stavros Macrakis
Date: Thu, 2 Feb 2012 16:08:00 -0500
mprint(zz) := print(sconcat(zz," = ",ev(zz)))$
and then mprint('a).
You could also define mprint as a macro (using ::=), but why complicate
things?
Note that mprint('zz) will not work properly (because of the "ev"), so you
should probably use a more obscure name
mprint(zz234) := print(sconcat(zz234," = ",ev(zz234)))$
-s
On Thu, Feb 2, 2012 at 16:02, Edwin Woollett <woollett at charter.net> wrote:
> I would like to define mprint(var) such that
> mprint(a) would give
> a = (value of a)
> so far I have tried:
> ------------------------------**--
>
> (%i1) a:2;
> (%o1) 2
>
> (%i2) mprint(zz) := print(sconcat(string(zz)," = "),zz)$
>
> (%i3) mprint(a);
> 2 = 2 (%o3) 2
>
> (%i4) mprint(zz) := print(sconcat(string('zz)," = "),zz)$
>
> (%i5) mprint(a);
> zz = 2 (%o5) 2
> -------------------
>
> Ted Woollett
>
>
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>