Dear Vladimir, On 1/8/25 11:36 AM, Vladimir V. Kisil via GiNaC-devel wrote:
Your proposal seems to be sensible to me. As a variation of it: can "print_deterministic" be just a flag for any declared printing method? It may be not so useful in outputs for C or Python, but printing a tree in a deterministic way may be an advantage.
That goes beyond my suggestion and I'm not sure it is possible. Anyway, we must be very careful with 'faking' a print order for the purpose of reproducibility. It is a double-edged sword: If you think that 'e' is 'a-b' you expect 'e.op(0)' to be 'a' and 'e.op(1)' to be '-b' but that is not going to be fulfilled by deterministic print orders. I think this suggests that the print order 'print_tree' should remain as it is. After all, it is mainly for debugging purposes. By the same token, I think that the print order of ginsh should remain as it is - non-deterministic - because ginsh offers the 'op(e,n)' built-in function. Making ginsh's print only order differ from that of 'op' would be too confusing. All my best, -richy. -- Richard B. Kreckel <https://in.terlu.de/~kreckel/>