Evaluated proc bitset {var pos {val {}}} {upvar 1 $var word; if ![info ex word] {set word 0}; if {$val != ""} {set word [expr {$val? $word | 1 << $pos : $word & ~(1 << $pos)}]}; expr {($word & 1 << $pos) != 0}}