Function: math-sort-terms

math-sort-terms is a byte-compiled function defined in calc-poly.el.gz.

Signature

(math-sort-terms EXPR)

Documentation

Sort the terms of a sum into canonical order.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-poly.el.gz
(defun math-sort-terms (expr)
  "Sort the terms of a sum into canonical order."
  (if (memq (car-safe expr) '(+ -))
      (math-list-to-sum
       (sort (math-sum-to-list expr)
             (lambda (a b) (math-beforep (car a) (car b)))))
    expr))