(let ((result (list (car list))))
(do ((x (cdr list) (cdr x))
(splice result
- (cdr (rplacd splice (cons (car x) '() ))) ))
+ (cdr (rplacd splice (cons (car x) '())))))
((atom x)
(unless (null x)
(rplacd splice x))))
(defun copy-alist (alist)
#!+sb-doc
"Return a new association list which is EQUAL to ALIST."
- (if (atom alist)
+ (if (endp alist)
alist
(let ((result
(cons (if (atom (car alist))
(car alist)
- (cons (caar alist) (cdar alist)) )
+ (cons (caar alist) (cdar alist)))
nil)))
(do ((x (cdr alist) (cdr x))
(splice result
(car x)
(cons (caar x) (cdar x)))
nil)))))
- ;; Non-null terminated alist done here.
- ((atom x)
- (unless (null x)
- (rplacd splice x))))
+ ((endp x)))
result)))
(defun copy-tree (object)
(defun nreconc (x y)
#!+sb-doc
"Return (NCONC (NREVERSE X) Y)."
- (do ((1st (cdr x) (if (atom 1st) 1st (cdr 1st)))
+ (do ((1st (cdr x) (if (endp 1st) 1st (cdr 1st)))
(2nd x 1st) ;2nd follows first down the list.
(3rd y 2nd)) ;3rd follows 2nd down the list.
((atom 2nd) 3rd)