I want my function to add an element to the end of a container, particularly a matrix. It seems that I can use pass-by-reference to alter an existing element within a container, but if I try to alter the size of the container using concat() I get the wrong result.
Here's a working example:
v=[1];
r(~x)=x=concat(x,2);
v \\ Should be [1,2]
%3 = [1]
Can I do this by reference, or will I need to pass by value and make a fresh assignment? If so, is this behaviour expected? I'm using GP/Pari 2.15.0.