Code example from Playing with Keyed Lists on Mac OS X Tcl/Tk Aqua 8.4.2

;# Listing 4. Retrieving inidividual atomic data fields.

set periodic_table_list {
  {87 {Francium {Fr} {223} {2-8-18-32-18-8-1} } }
  {88 {Radium {Ra} {226} {2-8-18-32-18-8-2} } }
  {104 {Rutherfordium {RF} {261} {2-8-18-32-32-10-2} } }
  {105 {Dubnium {Db} {262} {2-8-18-32-32-11-2} } }
  {106 {Seaborgium {Sg} {263} {2-8-18-32-32-12-2} } }
  {107 {Bohrium {Bh} {262} {2-8-18-32-32-13-2} } }
  {108 {Hassium {Hs} {265} {2-8-18-32-32-14-2} } }
  {109 {Meitnerium {Mt} {266} {2-8-18-32-32-15-2} } }
  {110 {Ununnilium {Uun} {269} {2-8-18-32-32-17-1} } }
  {111 {Unununium {Uuu} {272} {2-8-18-32-32-18-1} } }
  {112 {Ununbium {Uub} {277} {2-8-18-32-32-18-2} } }
  {113 {Ununtrium {Uut} {undiscovered} {undiscovered} } }
  {114 {Ununquadium {Uuq} {285} {2-8-18-32-32-18-4} } }
  {115 {Ununpentium {Uup} {undiscovered} {undiscovered} } }
  {116 {Ununhexium {Uuh} {289} {2-8-18-32-32-18-6} } }
  {117 {Ununseptium {Uus} {undiscovered} {undiscovered} } }
  {118 {Ununoctium {Uuo} {293} {2-8-18-32-32-18-8} } }
}

;# loop through each atom in the Tcl list
foreach atom $periodic_table_list {

    ;# retrieve the atomic number
    set atomic_number [lindex $atom 0]

    ;# extract the nested list, as demonstrated in Listing 3.
    ;# create a Tcl list from the nested list
    set atom_list [lindex $atom 1]

    ;# retrieve data from the Tcl list, atom_list
    set element_name [lindex $atom_list 0]
    set element_symbol [lindex $atom_list 1]
    set atomic_weight [lindex $atom_list 2]
    set electrons [lindex $atom_list 3]
    
    ;# display the data retrieved
    puts \
	"$element_name $element_symbol $atomic_weight $electrons"
}