lremoveTcl 9.1 only
Gives a list with the elements at some indexes removed.
lremove LIST ?INDEX ...?
Description
Gives a new list: LIST with no element at any of the INDEX arguments. The indexes all refer to LIST as it is, so their order does not matter, and an index that comes twice removes one element. An index out of range has no effect and is no error. With no INDEX the result is LIST.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| LIST | list | required | The list. |
| INDEX | index | none | The index of an element to remove. |
Returns
The new list.
Examples
% lremove {a b c d} 1 end
a c
% lremove {a b c d} end-1 0
b d
% lremove {a b c d} 1 1
a c d
% lremove {a b c d} 5
a b c d
% lremove {a b c d}
a b c d
Errors
% lremove {a b} x
bad index "x": must be integer?[+-]integer? or end?[+-]integer?
-errorcode NONE
% lremove
wrong # args: should be "lremove list ?index ...?"
-errorcode TCL WRONGARGS
Differences from Tcl
- A bad index has
-errorcode NONE, where Tcl 9.0.4 givesTCL VALUE INDEX(issue 658).
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 only.
- Since
- ztcl 1.0.0-beta.1