Changeset 265
- Timestamp:
- Jan 11, 2004, 11:30:46 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lib/lists.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lib/lists.lisp
r248 r265 156 156 157 157 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))))) 170 158 171 (defun butlast (list &optional (n 1 n-p)) 159 172 "Returns a new list the same as List without the N last elements." … … 164 177 (not (typep n 'unsigned-byte)))) 165 178 (report-bad-arg n 'unsigned-byte)) 166 (let* ((length ( length list)))179 (let* ((length (alt-list-length list))) 167 180 (declare (fixnum length)) ;guaranteed 168 181 (when (< n length) … … 184 197 (not (typep n 'unsigned-byte)))) 185 198 (report-bad-arg n 'unsigned-byte)) 186 (let* ((length ( length list)))199 (let* ((length (alt-list-length list))) 187 200 (declare (fixnum length)) ;guaranteed 188 201 (when (< n length)
Note:
See TracChangeset
for help on using the changeset viewer.
