Changeset 275
- Timestamp:
- Jan 13, 2004, 4:52:26 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lib/lists.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lib/lists.lisp
r265 r275 128 128 (defun copy-alist (alist) 129 129 "Returns a new association list equal to alist, constructed in space" 130 (if (atom alist) 131 (if alist 132 (report-bad-arg alist 'list)) 130 (unless (endp alist) 133 131 (let ((result 134 (cons (if ( atom(car alist))132 (cons (if (endp (car alist)) 135 133 (car alist) 136 134 (cons (caar alist) (cdar alist)) ) … … 140 138 (cdr (rplacd splice 141 139 (cons 142 (if ( atom(car x))140 (if (endp (car x)) 143 141 (car x) 144 142 (cons (caar x) (cdar x))) 145 143 '() ))) )) 146 ;;; Non-null terminated alist done here. 147 ((atom x) (unless (null x) 148 (rplacd splice x)) 149 result))))) 144 ((endp x) result))))) 150 145 151 146 ;;; More Commonly-used List Functions … … 156 151 157 152 158 (defun alt-list-length (l) 159 "Detect (and complain about) cirucular lists; allow any atom to 160 terminate the list" 161 (do* ((n 0 (1+ n)) 162 (fast l) 163 (slow l)) 164 ((atom fast) (if fast (the fixnum (1+ n)) n)) 165 (declare (fixnum n)) 166 (setq fast (cdr fast)) 167 (if (logbitp 0 n) 168 (if (eq (setq slow (cdr slow)) fast) 169 (%err-disp $XIMPROPERLIST l))))) 153 170 154 171 155 (defun butlast (list &optional (n 1 n-p))
Note:
See TracChangeset
for help on using the changeset viewer.
