next up previous index
Next: Creation Up: List Manipulation Commands Previous: List Manipulation Commands

Accessing

llength   list
Returns the length of a list:
% llength {a b c d}
4

lindex   list index
Returns the index-th element of the list:
% lindex "a b c d" 2
c
The elements are numbered from 0.

lrange   list first last
Returns a sublist of list consisting of the specified element range. last can also be end:
% lrange {a b c d e} 3 end
d e

lsearch   ?mode? list pattern
Search the list for the occurrence of an element which matches pattern and return its index, -1 if not found:
% lsearch {a b c d e} c
2
Available modes are: The default mode is -glob.



Micha Meier
Tue Jul 2 09:49:39 MET DST 1996