Logo

Programming-Idioms

Delete all the elements from index i (included) to index j (excluded) from the list items.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
items.removeRange(i, j);
items = [items(:,i-1), items(j:)]
import "slices"
items = slices.Delete(items, i, j)
items = append(items[:i], items[j:]...)
copy(items[i:], items[j:])
for k, n := len(items)-j+i, len(items); k < n; k++ {
	items[k] = nil
}
items = items[:len(items)-j+i]
items.removeAll(items.subList(i, j));
local function erase(t,i,j)
 for i=1,j-1 do
  t[i]=nil
 end
end
erase(items,i,j)
for index := j-1 downto i do
  items.delete(index);
splice @items, $i, ($j - $i);
items[i:j] = []
del items[i:j]
items.slice!(i...j)
items.drain(i..j)