CoCoA:Destroy

From ApCoCoAWiki

Destroy

delete rings

Description

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.

Example

  Use R ::= Q[x,y,z];
  X := 3;
  I := Ideal(x,y);  -- dependent on R
  ENV.R.Y := 5;  -- in global memory bound to R
  Use S ::= Q[a,b];
  Destroy R;
  RingEnvs();  -- R#1 created to hold because of the ideal I
[<quotes>Q</quotes>, <quotes>Qt</quotes>, <quotes>R#1</quotes>, <quotes>S</quotes>, <quotes>Z</quotes>]
-------------------------------
  Memory();  -- ENV.R.Y was destroyed along with R
[<quotes>I</quotes>, <quotes>It</quotes>, <quotes>X</quotes>]
-------------------------------
  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();
------------[Memory]-----------
I = 3
It = R#1 :: Ideal(x, y)
X = 3
-------------------------------
  RingEnvs();  -- subtle point here: the variable <quotes>It</quotes>
               -- is still dependent on R#1
[<quotes>Q</quotes>, <quotes>Qt</quotes>, <quotes>R#1</quotes>, <quotes>S</quotes>, <quotes>Z</quotes>]
-------------------------------
  RingEnvs();  -- However, the previous command caused It to become a
               -- string; hence, R#1 disappears.
[<quotes>Q</quotes>, <quotes>Qt</quotes>, <quotes>S</quotes>, <quotes>Z</quotes>]
-------------------------------

Syntax

Destroy R_1, ... , R_n

where each R_i is the identifier of a ring.

Clear

Delete

Memory Management

   <type>ring</type>
   <type>memory</type>