Skip to content
Snippets Groups Projects
Commit eca422cf authored by agoncharov's avatar agoncharov
Browse files

Changed the documentation string for the function `append', to better

reflect the standard and actual behavior.
parent eec3de69
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/list.lisp,v 1.35 2005/05/10 17:58:06 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/list.lisp,v 1.36 2009/07/17 02:15:04 agoncharov Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -255,9 +255,18 @@
;;; The remaining lists in the arguments are tacked to the end of the result
;;; using splice which cdr's down the end of the new list
(defun append (&rest lists)
"Construct a new list by concatenating the list arguments"
(do ((top lists (cdr top))) ;;Cdr to first non-null list.
(defun append (&rest args)
"Usually, but not always, returns a new list that is the
concatenation of Args. Each Arg in Args must be a proper list except
the last one, which may be any object. The function is not
destructive: for all but the last Arg, its list structure is copied.
The last argument is not copied; it becomes the cdr of the final
dotted pair of the concatenation of the preceding lists, or is
returned directly if there are no preceding non-empty lists. In the
latter case, if the last Arg is not a list, the returned value is
not a list either."
(do ((top args (cdr top))) ;;Cdr to first non-null list.
((atom top) '())
(cond ((null (car top))) ; Nil -> Keep looping
((not (consp (car top))) ; Non cons
......@@ -276,7 +285,7 @@
(not-proper-list-error (car top))))
(setq splice
(cdr (rplacd splice (cons (car x) ()) ))) )
(do ((y (cdr top) (cdr y))) ;;Copy rest of lists.
(do ((y (cdr top) (cdr y))) ;; Copy rest of args.
((atom (cdr y))
(setq splice (rplacd splice (car y)))
result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment