home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / tcl_447.lzh / TCL / tcl.lzh / tcl / help / lists < prev    next >
Text File  |  1990-05-03  |  1KB  |  35 lines

  1. LISTS
  2.  
  3.    A list is just a string with a list-like structure consisting 
  4.    of fields separated by white space.  For example, the string
  5.  
  6.    Al Sue Anne John
  7.  
  8.    is a list with four elements or fields.  Lists have the same
  9.    basic structure as command strings, except that a newline
  10.    character in a list is treated as a field separator just
  11.    like space or tab.  Conventions for braces and backslashes
  12.    are the same for lists as for commands.  For example, the
  13.    string
  14.  
  15.    a b\ c {d e {f g h}}
  16.  
  17.    is a list with three elements:  a, b c, and d e {f g h}.
  18.    Whenever an element is extracted from a list, the same rules
  19.    about backslashes and braces are applied as for commands.
  20.    Thus in the example above when the third element is
  21.    extracted from the list, the result is
  22.  
  23.    d e {f g h}
  24.  
  25.    (when the field was extracted, all that happened was to
  26.    strip off the outermost layer of braces).  Command
  27.    substitution is never made on a list (at least, not by the
  28.    list-processing commands;  the list can always be passed to
  29.    the Tcl interpreter for evaluation).
  30.  
  31.    The Tcl commands concat, foreach, index, length, list, and
  32.    range allow you to build lists, extract elements from them,
  33.    search them, and perform other list-related functions.
  34.  
  35.