From eca422cffd79e1149f2e6c81a6b15b2a1bfadb9f Mon Sep 17 00:00:00 2001
From: agoncharov <agoncharov>
Date: Fri, 17 Jul 2009 02:15:04 +0000
Subject: [PATCH] Changed the documentation string for the function `append',
 to better reflect the standard and actual behavior.

---
 code/list.lisp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/code/list.lisp b/code/list.lisp
index b46c05834..cc4b707ca 100644
--- a/code/list.lisp
+++ b/code/list.lisp
@@ -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)
-- 
GitLab