Subject: get name of variable as string in function?
From: Eric Reyssat
Date: Mon, 27 Feb 2012 19:39:07 +0100
Le 27/02/2012 19:31, Edwin Woollett a ?crit :
> On Feb. 2, 2012, Stavros Macrakis wrote:
> --------------------------
>> I suggest you keep things simple and modular:
>>
>> /* The worker function */
>> mprintx(name,val) := print(sconcat(" ",name," = "),val)$
>>
>> mprint('a,a)$
>> [snip]
> ----------------------------------
> How can I get nil to display as false and t to
> display as true?
>
> ---------------------------------
> (%i1) [a:false,b:true]$
>
> (%i2) mprintx(name,val) := print(sconcat(" ",name," = "),val)$
>
> (%i3) mprintx('a,a);
> a = nil (%o3) false
>
> (%i4) mprintx('b,b);
> b = t (%o4) true ---------------------
> Ted
>
It may depend on the maxima (or lisp ?) version :
(%i1) [a:false,b:true]$
(%i2) mprintx(name,val) := print(sconcat(" ",name," = "),val)$
(%i3) mprintx('a,a);
a = false
(%o3) false
(%i4) mprintx('b,b);
b = true
(%o4) true
I have :
Maxima version: 5.20.1
Maxima build date: 12:35 1/21/2010
Host type: i686-pc-linux-gnu
Lisp implementation type: CLISP
Lisp implementation version: 2.47 (2008-10-23) (built 3457458111)
(memory 3473062541)
Eric
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima