Skip to content

Commit

Permalink
Inline FILL and provide a specialized path for vectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
froggey committed Feb 16, 2017
1 parent 2c9ab87 commit 7e833fa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions system/sequence.lisp
Expand Up @@ -469,10 +469,17 @@
(setf (elt sequence-1 (+ start1 i)) (elt sequence-2 (+ start2 i))))
sequence-1)

(declaim (inline fill))
(defun fill (sequence item &key (start 0) end)
(unless end (setf end (length sequence)))
(dotimes (i (- end start))
(setf (elt sequence (+ i start)) item))
(etypecase sequence
(list
(let ((end (or end (length sequence))))
(dotimes (i (- end start))
(setf (elt sequence (+ i start)) item))))
(vector
(let ((end (or end (length sequence))))
(dotimes (i (- end start))
(setf (aref sequence (+ i start)) item)))))
sequence)

(defun map (result-type function first-sequence &rest more-sequences)
Expand Down

0 comments on commit 7e833fa

Please sign in to comment.