Function: calcFunc-reducer

calcFunc-reducer is an autoloaded and byte-compiled function defined in calc-map.el.gz.

Signature

(calcFunc-reducer FUNC VEC)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-map.el.gz
(defun calcFunc-reducer (func vec)
  (setq func (math-var-to-calcFunc func))
  (or (math-vectorp vec)
      (math-reject-arg vec 'vectorp))
  (let ((expr (car (setq vec (cdr vec)))))
    (if expr
	(progn
	  (ignore-errors
	    (and (symbolp func)
		 (let ((lfunc (or (cdr (assq func
					     '( (calcFunc-add . math-add)
						(calcFunc-sub . math-sub)
						(calcFunc-mul . math-mul)
						(calcFunc-div . math-div)
						(calcFunc-pow . math-pow)
						(calcFunc-mod . math-mod)
						(calcFunc-vconcat
						 .  math-concat) )))
				  func)))
		   (while (cdr vec)
		     (setq expr (funcall lfunc expr (nth 1 vec))
			   vec (cdr vec))))))
	  (while (setq vec (cdr vec))
	    (setq expr (math-build-call func (list expr (car vec)))))
	  (math-normalize expr))
      (or (math-identity-value func)
	  (math-reject-arg vec "*Vector is empty")))))