Logo

Programming-Idioms

  • Perl
  • Pascal
  • Rust

Idiom #291 Remove sublist

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

items.drain(i..j)
splice @items, $i, ($j - $i);
for index := j-1 downto i do
  items.delete(index);
items.removeRange(i, j);

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