A simple proc to compare the contents of two lists. It returns a list equal to the differences. #----------------# compare list a with b#----------------proc listcomp {a b} { set diff {} foreach i $a { if { [lsearch -exact $b $i]==-1} { } return $diff} set a {1 2 3 4 5 6} set b {2 4 6 8} puts "list a = \{$a\}\nlist b = \{$b\}\nThe difference between a and b is \{[listcomp $a $b]\}." |