up previous next
NewId

create a new identifier

Syntax
NewId():STRING

Description
This command is obsolescent! CoCoA-5 will easily allow to have temporary rings.

This function returns a string of the form V#N where N is an integer. Each time it is called, the integer N changes, producing a new string. The purpose is to produce identifiers for variables or rings. (CoCoA does not check for the unlikely event that variables of the same form have been defined without the use of NewId .) The function NewId is often used with Var .

The most important use for this function is for creating temporary rings within user-defined functions. For an example, see the section of the tutorial entitled Rings Inside User-Defined Functions.

Example
  NewId();
V#0
-------------------------------
  NewId();
V#1
-------------------------------
  X := NewId();
  X;
V#2
-------------------------------
  Var(X) := 3;
  Var(NewId()) := 4;
  Describe Memory();
------------[Memory]-----------
It = V#2
V#2 = 3
V#3 = 4
X = V#2
-------------------------------
  Y := NewId();
  Var(Y) ::= QQ[a,b];
  Use Var(Y);
  RingEnvs();
["QQ", "QQt", "R", "V#6", "ZZ"]
-------------------------------
  Y;
V#6
-------------------------------
  Var(Y);
QQ[a,b]
-------------------------------

See Also