Function: cl-copy-list

cl-copy-list is a byte-compiled function defined in cl-lib.el.gz.

Signature

(cl-copy-list LIST)

Documentation

Return a copy of LIST, which may be a dotted list.

The elements of LIST are not copied, just the list structure itself.

View in manual

Aliases

copy-list (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-lib.el.gz
(defun cl-copy-list (list)
  "Return a copy of LIST, which may be a dotted list.
The elements of LIST are not copied, just the list structure itself."
  (declare (side-effect-free error-free))
  (if (consp list)
      (let ((res nil))
	(while (consp list) (push (pop list) res))
	(prog1 (nreverse res) (setcdr res list)))
    (car list)))