[movitz-cvs] CVS update: movitz/losp/muerte/lists.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Thu Mar 18 09:24:24 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv22982

Modified Files:
	lists.lisp 
Log Message:
Have nthcdr bail out when nil is encountered.

Date: Thu Mar 18 04:24:23 2004
Author: ffjeld

Index: movitz/losp/muerte/lists.lisp
diff -u movitz/losp/muerte/lists.lisp:1.3 movitz/losp/muerte/lists.lisp:1.4
--- movitz/losp/muerte/lists.lisp:1.3	Tue Feb  3 04:57:49 2004
+++ movitz/losp/muerte/lists.lisp	Thu Mar 18 04:24:23 2004
@@ -9,7 +9,7 @@
 ;;;; Created at:    Tue Dec  5 18:40:11 2000
 ;;;; Distribution:  See the accompanying file COPYING.
 ;;;;                
-;;;; $Id: lists.lisp,v 1.3 2004/02/03 09:57:49 ffjeld Exp $
+;;;; $Id: lists.lisp,v 1.4 2004/03/18 09:24:23 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -133,7 +133,7 @@
 
 (defun nthcdr (n list)
   (do ()
-      ((= 0 n) list)
+      ((or (null list) (not (plusp n))) list)
     (decf n)
     (setf list (cdr list))))
 
@@ -200,10 +200,10 @@
 (defun copy-list (list)
   (if (null list)
       nil
-    (do* ((new-list (cons (pop list) nil))
-	  (new-tail new-list (cdr new-tail)))
-	((null list) new-list)
-      (setf (cdr new-tail) (cons (pop list) nil)))))
+    (let ((new-list (cons (pop list) nil)))
+      (do ((new-tail new-list (cdr new-tail)))
+	  ((null list) new-list)
+	(setf (cdr new-tail) (cons (pop list) nil))))))
 
 (defun list (&rest objects)
   (numargs-case





More information about the Movitz-cvs mailing list