Function: seq-mapn

seq-mapn is a byte-compiled function defined in seq.el.gz.

Signature

(seq-mapn FUNCTION SEQUENCES...)

Documentation

Return the result of applying FUNCTION to each element of SEQUENCEs.

Like seq-map, but FUNCTION is mapped over all SEQUENCEs. The arity of FUNCTION must match the number of SEQUENCEs, and the mapping stops on the shortest sequence. Return a list of the results.

View in manual

Implementations

(seq-mapn FUNCTION SEQUENCE &rest SEQUENCES) in `seq.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/seq.el.gz
(cl-defgeneric seq-mapn (function sequence &rest sequences)
  "Return the result of applying FUNCTION to each element of SEQUENCEs.
Like `seq-map', but FUNCTION is mapped over all SEQUENCEs.
The arity of FUNCTION must match the number of SEQUENCEs, and the
mapping stops on the shortest sequence.
Return a list of the results.

\(fn FUNCTION SEQUENCES...)"
  (let ((result nil)
        (sequences (seq-map (lambda (s)
                              (seq-into s 'list))
                            (cons sequence sequences))))
    (while (not (memq nil sequences))
      (push (apply function (seq-map #'car sequences)) result)
      (setq sequences (seq-map #'cdr sequences)))
    (nreverse result)))