I suspect it is never made explicit in the documentation, alas. It is
probably implicitly assumed to be that way since that's the way Lisp does
it.
-s
On Mon, May 25, 2009 at 10:12 AM, Rob Burns <rob_g_burns at yahoo.co.uk> wrote:
> Stavros,
>
> Many thanks, that explains it.
>
> Is this obvious somewhere in the documentation, I did not find it in the
> "help" info?
> Regards, Rob.
>
>
> ------------------------------
> *From:* Stavros Macrakis <macrakis at alum.mit.edu>
> *To:* Rob Burns <rob_g_burns at yahoo.co.uk>
> *Cc:* maxima at math.utexas.edu
> *Sent:* Friday, 22 May, 2009 14:39:58
> *Subject:* Re: [Maxima] function argument overwriitten?
>
> Maxima passes lists and matrices as objects, not as values. So if you
> modify them within your function, they are modified globally.
>
> -s
>
> On Fri, May 22, 2009 at 9:28 AM, Rob Burns <rob_g_burns at yahoo.co.uk>wrote:
>
>>
>> This seems like an error to me....
>>
>> What's going on here?
>> Create a function..
>> (%i6) f(v):=block([t],t:v,t[1]:99,t);
>> (%o6) f(v):=block([t],t:v,t[1]:99,t)
>> (%i7) a:[1,2,3];
>> (%o7) [1,2,3]
>> and execute it
>> (%i8) m:f(a);
>> (%o8) [99,2,3]
>> it has worked ok...
>> (%i9) m;
>> (%o9) [99,2,3]
>> BUT the source operand has been overwritten !!
>> (%i10) a;
>> (%o10) [99,2,3]
>>
>> Also the same thing happened when I mistakenly put a for v in the
>> definituion of f()
>>
>> Create a function..
>> (%i1) f(v):=block([t],t:a,t[1]:99,t);
>> (%o1) f(v):=block([t],t:a,t[1]:99,t)
>> (%i2) a:[1,2,3];
>> (%o2) [1,2,3]
>> and execute it
>> (%i3) m:f(a);
>> (%o3) [99,2,3]
>> it has worked ok...
>> (%i4) m;
>> (%o4) [99,2,3]
>> BUT the source operand has been overwritten !!
>> (%i5) a;
>> (%o5) [99,2,3]
>>
>> Am I missing something?
>> Regards, Rob.
>>
>>
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
>