Tcl8.5.19/Tk8.5.19 Documentation > TclCmd > list

Tcl/Tk Applications | Tcl Commands | Tk Commands | Tcl Library | Tk Library

NAME

list - Create a list

SYNOPSIS

list ?arg arg ...?

DESCRIPTION

This command returns a list comprised of all the args, or an empty string if no args are specified. Braces and backslashes get added as necessary, so that the lindex command may be used on the result to re-extract the original arguments, and also so that eval may be used to execute the resulting list, with arg1 comprising the command's name and the other args comprising its arguments. List produces slightly different results than concat: concat removes one level of grouping before forming the list, while list works directly from the original arguments.

EXAMPLE

The command
list a b "c d e  " "  f {g h}"
will return
a b {c d e  } {  f {g h}}
while concat with the same arguments will return
a b c d e f {g h}

SEE ALSO

lappend, lindex, linsert, llength, lrange, lrepeat, lreplace, lsearch, lset, lsort

KEYWORDS

element, list
Copyright © 1995-1997 Roger E. Critchlow Jr. Copyright © 1993 The Regents of the University of California. Copyright © 1994-1996 Sun Microsystems, Inc. Copyright © 2001 Kevin B. Kenny <kennykb(at)acm.org>. All rights reserved.