Function: cl-fill

cl-fill is an autoloaded and byte-compiled function defined in cl-seq.el.gz.

Signature

(cl-fill SEQ ITEM [KEYWORD VALUE]...)

Documentation

Fill the elements of SEQ with ITEM.

Keywords supported: :start :end

View in manual

Aliases

fill (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-fill (seq item &rest cl-keys)
  "Fill the elements of SEQ with ITEM.
\nKeywords supported:  :start :end
\n(fn SEQ ITEM [KEYWORD VALUE]...)"
  (cl--parsing-keywords ((:start 0) :end) ()
    (if (listp seq)
        (let ((p (nthcdr cl-start seq))
	      (n (and cl-end (- cl-end cl-start))))
          (while (and p (or (null n) (>= (decf n) 0)))
            (setcar p item)
	    (setq p (cdr p))))
      (or cl-end (setq cl-end (length seq)))
      (if (and (= cl-start 0) (= cl-end (length seq)))
          (fillarray seq item)
	(while (< cl-start cl-end)
          (aset seq cl-start item)
	  (setq cl-start (1+ cl-start)))))
    seq))