[GAP Forum] Different S and T

Gordon Royle gordon at csse.uwa.edu.au
Thu Jun 8 09:15:19 BST 2006


It shouldn't be surprising..

When you do

T := S

then S and T are two different names for the same underlying object,  
but there is still only one array.

(It is just like making an assignment of reference type in Java.)

If you actually want two copies of the underlying array, one to  
delete things from and one to remain unchanged, then you must  
explicitly tell GAP that you want a new copy of the array (analogous  
to "clone()" in Java)

So, replace

T := S

with

T := StructuralCopy(S);

Gordon


On 08/06/2006, at 2:58 PM, A. K. Upadhyay wrote:

> Hi,
>  Below, is a small GAP program. Which, to my surprise prints same  
> values for S and T. I would have like the values of S and T to be  
> the following :




More information about the Forum mailing list