up previous next

NewId

Syntax

NewId():STRING
    

Summary

create a new identifier

Description

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) ::= Q[a,b];
Use Var(Y);
RingEnvs();
["Q", "Qt", "R", "V#6", "Z"]
-------------------------------
Y;
V#6
-------------------------------
Var(Y);
Q[a,b]
-------------------------------
        
    

See Also