(x: Expression)
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Sort terms of a sum with `addOrder` semantics, computing each term's |
| 131 | * degree/lexicographic keys once instead of on every comparison (`addOrder` |
| 132 | * re-walks both expressions per comparison — O(n log n) walks per sort). |
| 133 | * The comparator chain below returns exactly the values `addOrder` would, |
| 134 | * and `Array.sort` is stable, so the result order is identical. |
| 135 | */ |
| 136 | export function sortAddTerms( |
no test coverage detected