From 8.5, expr operator for list inclusion test.
if {$el in $list} ...
is equivalent to, but much nicer than
if {[lsearch -exact $list $el] >= 0} ...
The negation ("not in") is ni. So 8.5 Tcl really makes us knights who say 'ni'... For users of earlier versions, the following little helper comes in handy:
proc in {list el} {expr [lsearch -exact $list $el] >= 0}} ... if [in $list $el] ...
- rs 2007-04-26
Category Command , well sub-command, as part of expr