mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 23:32:17 -08:00
FILL reimplemented using FILL-ARRAY-WITH-ELT.
This commit is contained in:
parent
0a4ae4ebd2
commit
51c98fd087
1 changed files with 9 additions and 4 deletions
|
|
@ -121,11 +121,16 @@
|
|||
(decf end))))))))
|
||||
|
||||
(defun fill (sequence item &key (start 0) end)
|
||||
;; INV: WITH-START-END checks the sequence type and size.
|
||||
(with-start-end start end sequence
|
||||
(do ((i start (1+ i)))
|
||||
((>= i end) sequence)
|
||||
(declare (fixnum i))
|
||||
(setf (elt sequence i) item))))
|
||||
(if (listp sequence)
|
||||
(do* ((x (nthcdr start sequence) (cdr x))
|
||||
(i (- end start) (1- i)))
|
||||
((zerop i)
|
||||
sequence)
|
||||
(declare (fixnum i) (cons x))
|
||||
(setf (first x) item))
|
||||
(si::fill-array-with-elt sequence item start end))))
|
||||
|
||||
(defun replace (sequence1 sequence2 &key (start1 0) end1 (start2 0) end2)
|
||||
(with-start-end start1 end1 sequence1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue