Function: -zip-fill

-zip-fill is a byte-compiled function defined in dash.el.

Signature

(-zip-fill FILL-VALUE &rest LISTS)

Documentation

Zip LISTS together, padding shorter lists with FILL-VALUE.

This is like -zip (which see), except it retains all elements at positions beyond the end of the shortest list. The number of returned groupings is equal to the length of the longest input list, and the length of each grouping is equal to the number of input LISTS.

Since the return value changes form depending on the number of arguments, it is generally recommended to use -zip-lists-fill instead, unless a list of dotted pairs is explicitly desired.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -zip-fill (fill-value &rest lists)
  "Zip LISTS together, padding shorter lists with FILL-VALUE.
This is like `-zip' (which see), except it retains all elements
at positions beyond the end of the shortest list.  The number of
returned groupings is equal to the length of the longest input
list, and the length of each grouping is equal to the number of
input LISTS.

Since the return value changes form depending on the number of
arguments, it is generally recommended to use `-zip-lists-fill'
instead, unless a list of dotted pairs is explicitly desired."
  (declare (pure t) (side-effect-free t))
  (cond ((null lists) ())
        ((dash--length= lists 2)
         (let ((list1 (car lists))
               (list2 (cadr lists))
               results)
           (while (or list1 list2)
             (push (cons (if list1 (pop list1) fill-value)
                         (if list2 (pop list2) fill-value))
                   results))
           (nreverse results)))
        ((apply #'-zip-lists-fill fill-value lists))))