Skip to content
Tcl Source Code Artifact [4dc0ec97c3]
Login

Artifact [4dc0ec97c3]

Artifact 4dc0ec97c3cae454e4c2d8a814743d898d01551b916cd0660bc7a5e230317011:



CommandName: lremove ManualSection: n Version: 9.0 TclPart: Tcl TclDescription: Tcl Built-In Commands Links:

Name

lremove - Remove elements from a list by index

Synopsis

::: {.synopsis} ::: [lremove]{.cmd} [list]{.arg} [index]{.optdot} :::

Description

lremove returns a new list formed by simultaneously removing zero or more elements of fIlistfR at each of the indices given by an arbitrary number of fIindexfR arguments. The indices may be in any order and may be repeated; the element at index will only be removed once. The index values are interpreted the same as index values for the command fBstring indexfR, supporting simple index arithmetic and indices relative to the end of the list. 0 refers to the first element of the list, and fBendfR refers to the last element of the list.

Examples

Removing the third element of a list:

% lremove {a b c d e} 2
a b d e

Removing two elements from a list:

% lremove {a b c d e} end-1 1
a c e

Removing the same element indicated in two different ways:

% lremove {a b c d e} 2 end-2
a b d e