next up previous index
Next: Modification Up: List Manipulation Commands Previous: Accessing

Creation

list   ?value value ... ?
  Returns a list whose elements are all the value arguments. This function is often necessary to create a list out of variables whose values are lists when they are passed to certain commands. When we simply concatenate them, the list is flat:
% set a {a b c d}
a b c d
% set b {1 2 3}
1 2 3
% llength "$a $b"
7
% llength [list $a $b]
2

concat   ?list list ... ?
Concatenates the elements of all lists to form one result list:
% concat {a b} {c {d e} f} "g h"
a b c {d e} f g h

join   list ?joinString?
Concatenates the element of the list with joinString as separator. The default separator is space, i.e. a 'dense' format of the list is produced:
% join {a     b     c}
a b c
The separator can also be empty:
% join "what does this string" ""
whatdoesthisstring

split   string ?splitString?
This is the opposite of join, it takes a string and creates a list out of it by replacing all occurrences of splitString by a space:
% split /usr/local/include/X11/X.h /
{} usr local include X11 X.h


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