I'm trying to simplify the notation of a recurring operation I use inside my function block definitions in Maxima. For instance, instead of writing
a: endcons(a,b),
everytime, I want to replace this for
a<-b.
However, if I define
infix("<-")$
"<-"(a,b):= a: endcons(a,b)
I'll obviously never get the list a to receive a new entry b at its end:
(%i1) infix("<-");
(%o1) "<-"
(%i50) "<-"(a,b):= a: endcons(b,a);
(%o50) a \<\- b:=a:endcons(b,a)
(%i48) a:[];
(a) []
(%i51) a<-b;
(%o51) [b]
(%i52) a;
(%o52) []
because a and b are called by value in the function/operator call. Is there any way I can get "<-" to call a by reference, so I can change the value of a in the global context, even when a is called as an argument?