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

    r11391 r12516  
    3434(in-package #:system)
    3535
    36 (eval-when (:compile-toplevel :load-toplevel :execute)
     36(require "EXTENSIBLE-SEQUENCES-BASE")
     37
     38#|(eval-when (:compile-toplevel :load-toplevel :execute)
    3739  (defmacro seq-dispatch (sequence list-form array-form)
    3840    `(if (listp ,sequence)
    3941         ,list-form
    40          ,array-form)))
     42         ,array-form)))|#
    4143
    4244(eval-when (:compile-toplevel :execute)
     
    146148  (mumble-replace-from-mumble))
    147149
    148 (defun %replace (target-sequence source-sequence target-start target-end source-start source-end)
    149   (declare (type (integer 0 #.most-positive-fixnum) target-start target-end source-start source-end))
    150   (seq-dispatch target-sequence
    151                 (seq-dispatch source-sequence
    152                               (list-replace-from-list)
    153                               (list-replace-from-mumble))
    154                 (seq-dispatch source-sequence
    155                               (mumble-replace-from-list)
    156                               (mumble-replace-from-mumble))))
    157 
    158150;;; REPLACE cannot default end arguments to the length of sequence since it
    159151;;; is not an error to supply nil for their values.  We must test for ends
    160152;;; being nil in the body of the function.
    161 (defun replace (target-sequence source-sequence &key
     153(defun replace (target-sequence source-sequence &rest args &key
    162154                                ((:start1 target-start) 0)
    163155                                ((:end1 target-end))
     
    168160  (let ((target-end (or target-end (length target-sequence)))
    169161  (source-end (or source-end (length source-sequence))))
    170     (%replace target-sequence source-sequence target-start target-end source-start source-end)))
     162    (declare (type (integer 0 #.most-positive-fixnum) target-start target-end source-start source-end))
     163    (sequence::seq-dispatch target-sequence
     164      (sequence::seq-dispatch source-sequence
     165        (list-replace-from-list)
     166  (list-replace-from-mumble)
     167  (apply #'sequence:replace target-sequence source-sequence args))
     168      (sequence::seq-dispatch source-sequence
     169        (mumble-replace-from-list)
     170  (mumble-replace-from-mumble)
     171  (apply #'sequence:replace target-sequence source-sequence args))
     172      (apply #'sequence:replace target-sequence source-sequence args))))
Note: See TracChangeset for help on using the changeset viewer.