Function: cl--mapcar-many

cl--mapcar-many is an autoloaded and byte-compiled function defined in cl-extra.el.gz.

Signature

(cl--mapcar-many CL-FUNC CL-SEQS &optional ACC)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;; Control structures.

;;;###autoload
(defun cl--mapcar-many (cl-func cl-seqs &optional acc)
  (if (cdr (cdr cl-seqs))
      (let* ((cl-res nil)
	     (cl-n (apply #'min (mapcar #'length cl-seqs)))
	     (cl-i 0)
	     (cl-args (copy-sequence cl-seqs))
	     cl-p1 cl-p2)
	(setq cl-seqs (copy-sequence cl-seqs))
	(while (< cl-i cl-n)
	  (setq cl-p1 cl-seqs cl-p2 cl-args)
	  (while cl-p1
	    (setcar cl-p2
		    (if (consp (car cl-p1))
			(prog1 (car (car cl-p1))
			  (setcar cl-p1 (cdr (car cl-p1))))
		      (aref (car cl-p1) cl-i)))
	    (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)))
	  (if acc
	      (push (apply cl-func cl-args) cl-res)
	    (apply cl-func cl-args))
	  (setq cl-i (1+ cl-i)))
	(and acc (nreverse cl-res)))
    (let ((cl-res nil)
	  (cl-x (car cl-seqs))
	  (cl-y (nth 1 cl-seqs)))
      (let ((cl-n (min (length cl-x) (length cl-y)))
	    (cl-i -1))
	(while (< (setq cl-i (1+ cl-i)) cl-n)
	  (let ((val (funcall cl-func
			      (if (consp cl-x) (pop cl-x) (aref cl-x cl-i))
			      (if (consp cl-y) (pop cl-y) (aref cl-y cl-i)))))
	    (when acc
	      (push val cl-res)))))
	(and acc (nreverse cl-res)))))