File: lempty.tcl

package info (click to toggle)
libapache2-mod-rivet 3.2.0-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 5,868 kB
  • sloc: xml: 8,496; tcl: 7,212; ansic: 6,959; sh: 5,030; makefile: 261; sql: 91; lisp: 78
file content (18 lines) | stat: -rw-r--r-- 309 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
###
## lempty <list>
##
##    Returns 1 if <list> is empty or 0 if it has any elements.  This command
##    emulates the TclX lempty command.
##
## $Id$
##
###

namespace eval ::rivet {

    proc lempty {list} {
        if {[catch {llength $list} len]} { return 0 }
        return [expr {$len == 0}]
    }

}