Skip to content
Tcl Source Code Artifact [ec7ec4001f]
Login

Artifact [ec7ec4001f]

Artifact ec7ec4001ff49e935b55edbe98d1daeda11f0e2321aaa00974f9404df6713f18:


---
CommandName: list
ManualSection: n
Version: unknown
TclPart: Tcl
TclDescription: Tcl Built-In Commands
Links:
 - lappend(n)
 - lassign(n)
 - ledit(n)
 - lindex(n)
 - linsert(n)
 - llength(n)
 - lmap(n)
 - lpop(n)
 - lrange(n)
 - lremove(n)
 - lrepeat(n)
 - lreplace(n)
 - lreverse(n)
 - lsearch(n)
 - lseq(n)
 - lset(n)
 - lsort(n)
Keywords:
 - element
 - list
 - quoting
Copyright:
 - Copyright (c) 1993 The Regents of the University of California.
 - Copyright (c) 1994-1996 Sun Microsystems, Inc.
 - Copyright (c) 2001 Kevin B. Kenny <[email protected]>. All rights reserved.
---

# Name

list - Create a list

# Synopsis

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

# Description

This command returns a list comprised of all the *arg*s, or an empty string if no *arg*s 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 *arg*s 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}
```