Re: 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

Re: Handling pathological lists

From: Ralf Fassel <ralfixx@gmx.de>
Date: Fri Oct 28 2005 - 18:24:35 CEST

* "Juan C. Gil" <jgil@gmv.es>
| Do you want the length of that first element as a list?
|
| => llength [list [lindex $myList 0]]
| 1

This will always be 1, regardless of what is in the first element.

As Bruce pointed out, the OP needs to build the list in the first
place as a list of *lists* if the individual elements are to be
treated as lists later.

  set myList [list "{ {" "} }"]
  lindex $myList 0
  => { {
  llength [list [lindex $myList 0]]
  => 1

  set myList [list [list \{ \{] [list \} \}]]
  lindex $myList 0
  => \{ \{
  llength [lindex $myList 0]
  => 2

R'
Received on Mon Nov 21 00:36:46 2005