Function: ARRAY-SHIFT-RIGHT

Documentation

- shifts all elements between start and end to the right - rightmost element (at :end) is removed from array - inserts a new value at start

Source

(defun array-shift-right (array &key (start 0) (end (1- (length array)))
			  (replace nil))
  "- shifts all elements between start and end to the right
   - rightmost element (at :end) is removed from array
   - inserts a new value at start"
  (loop for i from (1- end) downto start
	for j from end downto start
	do (setf (aref array j)
		 (aref array i))
	finally (progn (setf (aref array start) replace)
		       (return array))))
Source Context