Changeset 12516 for trunk/abcl/src/org/armedbear/lisp/find.lisp
- Timestamp:
- 03/03/10 21:05:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/find.lisp
r11391 r12516 31 31 32 32 (in-package #:system) 33 34 (require "EXTENSIBLE-SEQUENCES-BASE") 33 35 34 36 ;;; From CMUCL. … … 143 145 144 146 145 (defun position (item sequence & key from-end (test #'eql) test-not (start 0)146 147 ( if (listp sequence)148 149 (vector-position* item sequence from-end test test-not start end key)))150 147 (defun position (item sequence &rest args &key from-end (test #'eql) test-not 148 (start 0) end key) 149 (sequence::seq-dispatch sequence 150 (list-position* item sequence from-end test test-not start end key) 151 (vector-position* item sequence from-end test test-not start end key) 152 (apply #'sequence:position item sequence args))) 151 153 152 154 (defun list-position* (item sequence from-end test test-not start end key) … … 168 170 `(list-locater-if ,test ,sequence :position)) 169 171 170 (defun position-if (test sequence &key from-end (start 0) key end) 171 (declare (type fixnum start)) 172 (let ((end (or end (length sequence)))) 173 (declare (type fixnum end)) 174 (if (listp sequence) 175 (list-position-if test sequence) 176 (vector-position-if test sequence)))) 172 (defun position-if (test sequence &rest args &key from-end (start 0) key end) 173 (declare (type fixnum start)) 174 (let ((end (or end (length sequence)))) 175 (declare (type fixnum end)) 176 (sequence::seq-dispatch sequence 177 (list-position-if test sequence) 178 (vector-position-if test sequence) 179 (apply #'sequence:position-if test sequence args)))) 177 180 178 181 (defmacro vector-position-if-not (test sequence) … … 182 185 `(list-locater-if-not ,test ,sequence :position)) 183 186 184 (defun position-if-not (test sequence &key from-end (start 0) key end) 185 (declare (type fixnum start)) 186 (let ((end (or end (length sequence)))) 187 (declare (type fixnum end)) 188 (if (listp sequence) 189 (list-position-if-not test sequence) 190 (vector-position-if-not test sequence)))) 187 (defun position-if-not (test sequence &rest args &key from-end (start 0) key end) 188 (declare (type fixnum start)) 189 (let ((end (or end (length sequence)))) 190 (declare (type fixnum end)) 191 (sequence::seq-dispatch sequence 192 (list-position-if-not test sequence) 193 (vector-position-if-not test sequence) 194 (apply #'sequence:position-if-not test sequence args)))) 191 195 192 196 (defmacro vector-find (item sequence) … … 208 212 (vector-find item sequence)) 209 213 210 (defun find (item sequence & key from-end (test #'eql) test-not (start 0)211 214 (defun find (item sequence &rest args &key from-end (test #'eql) test-not 215 (start 0) end key) 212 216 (let ((end (check-sequence-bounds sequence start end))) 213 (if (listp sequence) 214 (list-find* item sequence from-end test test-not start end key) 215 (vector-find* item sequence from-end test test-not start end key)))) 217 (sequence::seq-dispatch sequence 218 (list-find* item sequence from-end test test-not start end key) 219 (vector-find* item sequence from-end test test-not start end key) 220 (apply #'sequence:find item sequence args)))) 216 221 217 222 (defmacro vector-find-if (test sequence) … … 221 226 `(list-locater-if ,test ,sequence :element)) 222 227 223 (defun find-if (test sequence &key from-end (start 0) end key) 224 (let ((end (or end (length sequence)))) 225 (declare (type fixnum end)) 226 (if (listp sequence) 227 (list-find-if test sequence) 228 (vector-find-if test sequence)))) 228 (defun find-if (test sequence &rest args &key from-end (start 0) end key) 229 (let ((end (or end (length sequence)))) 230 (declare (type fixnum end)) 231 (sequence::seq-dispatch sequence 232 (list-find-if test sequence) 233 (vector-find-if test sequence) 234 (apply #'sequence:find-if test sequence args)))) 229 235 230 236 (defmacro vector-find-if-not (test sequence) … … 234 240 `(list-locater-if-not ,test ,sequence :element)) 235 241 236 (defun find-if-not (test sequence &key from-end (start 0) end key) 237 (let ((end (or end (length sequence)))) 238 (declare (type fixnum end)) 239 (if (listp sequence) 240 (list-find-if-not test sequence) 241 (vector-find-if-not test sequence)))) 242 (defun find-if-not (test sequence &rest args &key from-end (start 0) end key) 243 (let ((end (or end (length sequence)))) 244 (declare (type fixnum end)) 245 (sequence::seq-dispatch sequence 246 (list-find-if-not test sequence) 247 (vector-find-if-not test sequence) 248 (apply #'sequence:find-if-not test sequence args))))
Note: See TracChangeset
for help on using the changeset viewer.