Function: calc-build-assoc-term

calc-build-assoc-term is a byte-compiled function defined in calcsel2.el.gz.

Signature

(calc-build-assoc-term OP LHS RHS)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calcsel2.el.gz
(defun calc-build-assoc-term (op lhs rhs)
  (cond ((and (eq op '+) (or (math-looks-negp rhs)
			     (and (eq (car-safe rhs) 'cplx)
				  (math-negp (nth 1 rhs))
				  (eq (nth 2 rhs) 0))))
	 (list '- lhs (math-neg rhs)))
	((and (eq op '-) (or (math-looks-negp rhs)
			     (and (eq (car-safe rhs) 'cplx)
				  (math-negp (nth 1 rhs))
				  (eq (nth 2 rhs) 0))))
	 (list '+ lhs (math-neg rhs)))
	((and (eq op '*) (and (eq (car-safe rhs) '/)
			      (or (math-equal-int (nth 1 rhs) 1)
				  (equal (nth 1 rhs) '(cplx 1 0)))))
	 (list '/ lhs (nth 2 rhs)))
	((and (eq op '/) (and (eq (car-safe rhs) '/)
			      (or (math-equal-int (nth 1 rhs) 1)
				  (equal (nth 1 rhs) '(cplx 1 0)))))
	 (list '/ lhs (nth 2 rhs)))
	(t (list op lhs rhs))))