Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #291 Remove sublist

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

items.removeRange(i, j);
items = [items(:,i-1), items(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]
for index := j-1 downto i do
  items.delete(index);
items[i:j] = []
del items[i:j]
items.slice!(i...j)
items.drain(i..j)

New implementation...
< >
programming-idioms.org