[GAP Forum] Different S and T

reichard at maths.uwa.edu.au reichard at maths.uwa.edu.au
Thu Jun 8 09:33:54 BST 2006


Ashish,

if you replace the line

gap> T := S;

by

gap> T := StructuralCopy(S);

you get the wanted beaviour. In your code, S and T are simply different
names for the same object, so when you change T, you also change S. See
also the manual at

?structuralcopy

Best regards,
Sven Reichard.

> 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
> :
>
>  S:= remains unchanged
>  T:=[[0,2,5],[0,5,8],[0,2,3,5],[0,3,4,5]]
>
>  I would be greatful if someone indicates a way out
>
>  Thanks
>
>  Ashish
>
>  ###########################################
>  R:=[];;T:=[];;
>  S:=[[0,1,2,5],[0,1,5,8],[0,2,3,5],[0,3,4,5]];;
>  T:=S;;
T := StructuralCopy( S );
>  for i in [1..4] do
>  if 1 in T[i] then
>  RemoveSet(T[i],1);
>  AddSet(R,T[i]);
>  fi;
>  od;
>  Print("\n R = ", R , "\n S = ", S , "\n  T = ", T , "\n");
>  ############################################
>
>  Send instant messages to your online friends
> http://in.messenger.yahoo.com
>
>  Stay connected with your friends even when away from PC.  Link:
> http://in.mobile.yahoo.com/new/messenger/
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>
>
>






More information about the Forum mailing list