Ignore:
Timestamp:
03/03/10 21:05:41 (11 years ago)
Author:
astalla
Message:

Support for user-extensible sequences, adapted from SBCL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/remove.lisp

    r12217 r12516  
    3333
    3434(require "DELETE") ; MUMBLE-DELETE-FROM-END
     35(require "EXTENSIBLE-SEQUENCES-BASE")
    3536
    3637;;; From CMUCL.
     
    156157    (not (funcall predicate (apply-key key this-element)))))
    157158
    158 (defun remove (item sequence &key from-end (test #'eql) test-not (start 0)
    159                     end count key)
     159(defun remove (item sequence &rest args &key from-end (test #'eql) test-not
     160         (start 0) end count key)
    160161  (let* ((length (length sequence))
    161162   (end (or end length))
    162163   (count (real-count count)))
    163     (if (listp sequence)
    164         (if from-end
    165             (normal-list-remove-from-end)
    166             (normal-list-remove))
    167         (if from-end
    168             (normal-mumble-remove-from-end)
    169             (normal-mumble-remove)))))
     164    (sequence::seq-dispatch sequence
     165      (if from-end
     166    (normal-list-remove-from-end)
     167    (normal-list-remove))
     168      (if from-end
     169    (normal-mumble-remove-from-end)
     170    (normal-mumble-remove))
     171      (apply #'sequence:remove item sequence args))))
    170172
    171 (defun remove-if (predicate sequence &key from-end (start 0) end count key)
     173(defun remove-if (predicate sequence &rest args &key from-end (start 0)
     174      end count key)
    172175  (let* ((length (length sequence))
    173176   (end (or end length))
    174177   (count (real-count count)))
    175     (if (listp sequence)
    176         (if from-end
    177             (if-list-remove-from-end)
    178             (if-list-remove))
    179         (if from-end
    180             (if-mumble-remove-from-end)
    181             (if-mumble-remove)))))
     178    (sequence::seq-dispatch sequence
     179      (if from-end
     180    (if-list-remove-from-end)
     181    (if-list-remove))
     182      (if from-end
     183    (if-mumble-remove-from-end)
     184    (if-mumble-remove))
     185      (apply #'sequence:remove-if predicate sequence args))))
    182186
    183 (defun remove-if-not (predicate sequence &key from-end (start 0) end count key)
     187(defun remove-if-not (predicate sequence &rest args &key from-end (start 0)
     188          end count key)
    184189  (let* ((length (length sequence))
    185190   (end (or end length))
    186191   (count (real-count count)))
    187     (if (listp sequence)
    188         (if from-end
    189             (if-not-list-remove-from-end)
    190             (if-not-list-remove))
    191         (if from-end
    192             (if-not-mumble-remove-from-end)
    193             (if-not-mumble-remove)))))
     192    (sequence::seq-dispatch sequence
     193      (if from-end
     194    (if-not-list-remove-from-end)
     195    (if-not-list-remove))
     196      (if from-end
     197    (if-not-mumble-remove-from-end)
     198    (if-not-mumble-remove))
     199      (apply #'sequence:remove-if-not predicate sequence args))))
Note: See TracChangeset for help on using the changeset viewer.