Functions may leak information about names(!) of localvariables.



What you say is not true. Changing t to tt makes no difference!

Michel


Richard Fateman wrote:
> The problem you have encountered is that t is a synonym for the truth value
> true.
>
> If you change t to tt  inside g(s), uniformly, then the answer you get for
> g(t); is 64.
>
> Is this a bug? Perhaps.  Lisp uses the variable "t"  for true, and this is
> how the idea originated. Is this more confusing than useful at this time?
> Probably.
>
> At least in wxmaxima, if you write t[n]:=n^3; it is displayed as
> true[n]:=n^3.
>
> RJF
>
>
>   
>> -----Original Message-----
>> From: maxima-bounces at math.utexas.edu [mailto:maxima-
>> bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh
>> Sent: Thursday, December 28, 2006 5:33 AM
>> To: maxima at math.utexas.edu
>> Subject: Functions may leak information about names(!) of
>> localvariables.
>>
>> I really don't see how to do robust programming in maxima.
>>
>> Consider
>>
>> g(s):=block([t],local(t), t[4]:subvar(s,4), t[4]);
>> t[n]:=n^3;
>> u[n]:=n^4;
>>
>> g(u);
>>       256
>> g(t);
>>      t_4
>>
>> What is the correct way of dealing with this? Or should one just say that
>> arrays are not first class objects and should not be passed around in
>> this way?
>> That would be a pity.
>>
>> Michel
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>     
>
>