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

Why doesn't "occurs" accept $-variables? #233

Open tueda opened 6 years ago

tueda commented 6 years ago

It would be nice if one can write like

S x;
L F = x;
$x = x;
if (occurs($x));
  P "Found: %t";
endif;
.end

which currently give a compilation error. Of course when a content of the $-variable is illegal for the parameter of occurs, e.g., an expression 1+x, a runtime error should occur. For now a workaround woube be (assuming $x is always a symbol):

S x,TMP;
L F = x;
$x = x;
multiply replace_($x,TMP);
if (occurs(TMP));
  multiply replace_(TMP,$x);
  P "Found: %t";
else;
  multiply replace_(TMP,$x);
endif;
.end
tueda commented 6 years ago

Unfortunately the follwing doen't work

if (occurs(pp[$n]));
* ...
endif;

and then what I could write depends on again occurs with a $-variable:

$p = pp[$n];
if (occurs($p));
* ...
endif;