If this was a full-blown Tcl then you could do 

        dict keys [concat {*}$twoDlist]

but I suspect that TH1 has neither dictionaries nor the {*} operator.
How about

        set oneDlist ""
        foreach pair $twoDlist {lappend oneDlist [lindex $pair 0]}

Paul Higham
Tel +1 408 522 6225
phig...@sjm.com
-----Original Message-----
From: fossil-users-boun...@lists.fossil-scm.org
[mailto:fossil-users-boun...@lists.fossil-scm.org] On Behalf Of Erlend
Leganger
Sent: Sunday, June 12, 2011 13:39
To: fossil-users@lists.fossil-scm.org
Subject: [fossil-users] TH1 - make 1d list from 2d list?

I want to create a one dimensional list from a two dimensional source
list. Here is what I have done:

set twoDlist{
   {UN "United Nations"}
   {EU "European Union}
   {BRICS "Brazil, Russia, India, China, South Africa}
}

set oneDlist ""
for {set x 0} {$x < [llength $twoDlist]} {set x [expr {$x + 1}]} {
   set oneDlist "$oneDlist [lindex [lindex $twoDlist $x] 0]"
}

This works (the resulting list contains {UN EU BRICS}), but it seems
clunky. Is there are more elegant way to do this?

Cheers,
Erlend
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
This communication, including any attachments, may contain information that is 
proprietary, privileged, confidential or legally exempt from disclosure.  If 
you are not a named addressee, you are hereby notified that you are not 
authorized to read, print, retain a copy of or disseminate any portion of this 
communication without the consent of the sender and that doing so may be 
unlawful.  If you have received this communication in error, please immediately 
notify the sender via return e-mail and delete it from your system.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to