Hi, On 2/10/26 2:11 PM, Richard B. Kreckel wrote:
So I've changed the add and mul classes' dflt and latex print context handlers to internally pre-sort the expressions before printing.
It is quite nice to see that this loop: for i in $(seq 1 1000); do echo "expand(a*(a+b)*(a+b+c)*(a+b+c+d));" | ginsh; done |sort|uniq produces just one output instead of oodles of lines.
On the other hand, changing the ginsh command to "op(expand(a*(a+b)*(a+b+c)*(a+b+c+d)),3);" still prints several lines, which is expected since it is only the output which is sorted in a lexicographical order.
All other print contexts are unchanged.
I invite people to check out the current code from git and see if this is good. If it has some bad side effects, please let us know here and I'll revert the patch before the next release. (We want to release this in February.)
It is better not to change the 'dflt' output. So, I've added a 'sortex' print context, specializing 'dflt'. Ginsh uses this, for now. If this bothers someone for whatever reason, we can make it possible to turn it off in ginsh, using an option. All my best, -richard. -- Richard B. Kreckel <https://in.terlu.de/~kreckel/>