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/substitute.lisp

    r11391 r12516  
    3030;;; exception statement from your version.
    3131
     32(require "EXTENSIBLE-SEQUENCES-BASE")
    3233
    3334(in-package "COMMON-LISP")
     
    110111
    111112(defmacro subst-dispatch (pred)
    112   `(if (listp sequence)
     113  `(sequence::seq-dispatch sequence
    113114       (if from-end
    114115           (nreverse (list-substitute* ,pred new (reverse sequence)
     
    123124                               (1- start) count key test test-not old)
    124125           (vector-substitute* ,pred new sequence 1 0 length length
    125                                start end count key test test-not old))))
     126                               start end count key test test-not old))
     127       ,(ecase (cadr pred) ;;pred is (quote <foo>)
     128    (normal `(apply #'sequence:substitute new old sequence args))
     129    (if `(apply #'sequence:substitute-if new test sequence args))
     130    (if-not `(apply #'sequence:substitute-if-not new test sequence args)))))
    126131
    127132
    128 (defun substitute (new old sequence &key from-end (test #'eql) test-not
     133(defun substitute (new old sequence &rest args &key from-end (test #'eql) test-not
    129134                       (start 0) count end key)
    130135  (let* ((length (length sequence))
     
    134139
    135140
    136 (defun substitute-if (new test sequence &key from-end (start 0) end count key)
     141(defun substitute-if (new test sequence &rest args &key from-end (start 0) end count key)
    137142  (let* ((length (length sequence))
    138143   (end (or end length))
     
    143148
    144149
    145 (defun substitute-if-not (new test sequence &key from-end (start 0)
     150(defun substitute-if-not (new test sequence &rest args &key from-end (start 0)
    146151                              end count key)
    147152  (let* ((length (length sequence))
Note: See TracChangeset for help on using the changeset viewer.