Posted to tcl by hypnotoad at Tue Jun 18 16:39:03 GMT 2019view raw

  1. proc cols list {
  2. set level 0
  3. set col $list
  4. while {[llength $col]} {
  5. set col [lindex $col 0]
  6. incr level
  7. if {$level > 100} break ; # safety
  8. }
  9. return $level
  10. }
  11.  

Comments

Posted by rkeene at Tue Jun 18 16:46:09 GMT 2019 [text] [code]

proc isEmptyListNested list { set level 0 set col $list while 1 { if {[llength $col] > 1} { return false } if {[llength $col] < 1} { return true } set col [lindex $col 0] incr level if {$level > 100} break ; # safety } return $level }