Function: math-rwcomp-priority
math-rwcomp-priority is a byte-compiled function defined in
calc-rewr.el.gz.
Signature
(math-rwcomp-priority EXPR)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-rewr.el.gz
;; Order of priority: 0 Constants and other exact matches (first)
;; 10 Functions (except below)
;; 20 Meta-variables which occur more than once
;; 30 Algebraic functions
;; 40 Commutative/associative functions
;; 50 Meta-variables which occur only once
;; +100 for every "!!!" (pnot) in the pattern
;; 10000 Optional arguments (last)
(defun math-rwcomp-priority (expr)
(+ (math-rwcomp-count-pnots expr)
(cond ((eq (car-safe expr) 'calcFunc-opt)
10000)
((math-rwcomp-no-vars expr)
0)
((eq (car expr) 'calcFunc-quote)
0)
((eq (car expr) 'var)
(if (assq (nth 2 expr) math-regs)
0
(if (= (math-rwcomp-count-refs expr) 1)
50
20)))
(t (let ((props (get (car expr) 'math-rewrite-props)))
(if (or (memq 'commut props)
(memq 'assoc props))
40
(if (memq 'algebraic props)
30
10)))))))