up previous next

delete rings

Destroy R_1, ... , R_n

where each R_i is the identifier of a ring.

This command clears all global variables bound to the listed rings. Moreover, if R is a ring in the list and there are no variables in the current memory dependent upon R, then the ring identified by R is deleted; otherwise R is renamed with a name of the form R#N where N is an integer. This renamed ring is automatically removed as soon as the last variable dependent upon it is deleted.

The command will not work if one of the listed rings is the current ring.

For more information about memory in CoCoA, see the chapter entitled Memory Management.

  Use R ::= QQ[x,y,z];
  X := 3;
  I := Ideal(x,y);  -- dependent on R
  ENV.R.Y := 5;  -- in global memory bound to R
  Use S ::= QQ[a,b];
  Destroy R;
  RingEnvs();  -- R#1 created to hold because of the ideal I
["QQ", "QQt", "R#1", "S", "ZZ"]
  Memory();  -- ENV.R.Y was destroyed along with R
["I", "It", "X"]
  I;  -- I was not destroyed
R#1 :: Ideal(x, y)
  I := 3;  -- overwrite I; it is no longer dependent on a CoCoA ring
  Describe Memory();
I = 3
It = R#1 :: Ideal(x, y)
X = 3
  RingEnvs();  -- subtle point here: the variable "It"
               -- is still dependent on R#1
["QQ", "QQt", "R#1", "S", "ZZ"]
  RingEnvs();  -- However, the previous command caused It to become a
               -- string; hence, R#1 disappears.
["QQ", "QQt", "S", "ZZ"]

See Also