vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.13k stars 135 forks source link

What is the recommended way to redefine an expression? #244

Open tueda opened 6 years ago

tueda commented 6 years ago

Is there any simple way to redefine an expression without (all)warnings? The following code gives a warning for replacing the expression F, though I have explicitly declared F will be dropped unless any redefinition is given:

On allwarnings;
L F = 2;
.sort
Drop F;
L F = 3 * F;
P;
.end
FORM 4.2.0 (Oct 26 2017, v4.2.0-22-g954024f) 64-bits  Run: Fri Nov 24 13:19:05 2017
    On allwarnings;
    L F = 2;
    .sort

Time =       0.00 sec    Generated terms =          1
               F         Terms in output =          1
                         Bytes used      =         20
    Drop F;
    L F = 3 * F;
test.frm Line 5 --> Warning: Expression is replaced by new definition
    P;
    .end

Time =       0.00 sec    Generated terms =          1
               F         Terms in output =          1
                         Bytes used      =         20

   F =
      6;

In principle, one can copy the expression to a temporary expression like

On allwarnings;
L F = 2;
.sort
Drop F;
L tmp = F;
.sort
Drop tmp;
L F = 3 * tmp;
P;
.end

but it looks nasty and has some overheads.