Handling pathological lists
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Handling pathological lists

From: keithv <kvetter@gmail.com>
Date: Fri Oct 28 2005 - 16:49:52 CEST

Boiling down a complex problem to a simple problem,
I need to find the llength of the first item of a
list. Simple right? Just:

   llength [lindex $myList 0]

But this fails if you have a pathological list such as:

   set myList [list \{ \}]

=> llength [lindex $myList]
   unmatched open brace in list

Granted this is a contrived example, but is there
a way of handling this without resorting to catch?

Keith
Received on Mon Nov 21 00:36:42 2005