Function: math-map-vec-2

math-map-vec-2 is an autoloaded and byte-compiled function defined in calc-vec.el.gz.

Signature

(math-map-vec-2 F A B)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-vec.el.gz
;;; Apply a function elementwise to vectors A and B.  [O X O O] [Public]
(defun math-map-vec-2 (f a b)
  (if (math-vectorp a)
      (if (math-vectorp b)
	  (let ((v nil))
	    (while (setq a (cdr a))
	      (or (setq b (cdr b))
		  (math-dimension-error))
	      (setq v (cons (funcall f (car a) (car b)) v)))
	    (if a (math-dimension-error))
	    (cons 'vec (nreverse v)))
	(let ((v nil))
	  (while (setq a (cdr a))
	    (setq v (cons (funcall f (car a) b) v)))
	  (cons 'vec (nreverse v))))
    (if (math-vectorp b)
	(let ((v nil))
	  (while (setq b (cdr b))
	    (setq v (cons (funcall f a (car b)) v)))
	  (cons 'vec (nreverse v)))
      (funcall f a b))))