Mathematical set based functions Of obvious enough kind, but important, and underused, I guess. Page started by [Theo Verelst] These are the first definitions: proc setempty {} {return {}} proc setadd {a b} {return [setjoin $a $b]} proc setisempty {s} { if {$s == {}} {return 1} {return 0} } proc setsize {s} {return [llength $s]} proc setjoin {a b} { set o {}; foreach i $a { if {[lsearch $b $i] < 0} {lappend o $i} }; lappend o $b; return $o } proc setunion {a b} {set o {}; foreach i $a {if {[lsearch $b $i] >= 0} {lappend o $i}}; return $o}