Evaluated proc ansi:closest2 {hex list} { set h ""; set d 16777215; for {set x 0} {$x < [llength $list]} {incr x} { set d2 [hex_distance $hex [lindex $list $x]]; if {$d2 < $d} {set d $d2; set h $x }  }; return $h }