The following code causes an infinite recursion:
e: log(e)$
rectform(e);
The following doesn't:
e: log(f)$
rectform(e);
g: sqrt(g)$
rectform(g);
See mailing list posting "Issue with "rectform" and function/lambda parameter that's named like a variable".
Robert Dodier:
realpart and imagpart cause the same error.
Tracing MEVAL shows that's it's being called over and over to evaluate
notequal(log(e), 0). A stack trace shows $RECTFORM eventually calls
MEQP-BY-CSIGN which calls $REALPART which eventually calls MEQP-BY-CSIGN
again and the cycle continues.I believe this is a bug in the predicate evaluation code -- MEVALP1
calls MEVAL.
This should be fixed with [ca5af3] which I just pushed. I think that MEQP-BY-CSIGN recurses through $REALPART on purpose. Unfortunately, this particular (self-referential) example means that's a bit disastrous. So I've pushed a patch that catches recursions that look like they're going to diverge ("Hey, I've been here with this argument before...").
Related
Commit: [ca5af3]