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

Aliases

fill (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-fill (cl-seq cl-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 cl-seq)
	(let ((p (nthcdr cl-start cl-seq))
	      (n (and cl-end (- cl-end cl-start))))
	  (while (and p (or (null n) (>= (cl-decf n) 0)))
	    (setcar p cl-item)
	    (setq p (cdr p))))
      (or cl-end (setq cl-end (length cl-seq)))
      (if (and (= cl-start 0) (= cl-end (length cl-seq)))
	  (fillarray cl-seq cl-item)
	(while (< cl-start cl-end)
	  (aset cl-seq cl-start cl-item)
	  (setq cl-start (1+ cl-start)))))
    cl-seq))