1 if {[catch {lsearch -sorted {a b c
} b
}]} {
2 proc tlc
::intersect3 {list1 list2
} {
8 set list1
[lsort -unique $list1]
9 set list2
[lsort -unique $list2]
13 if {[lsearch $list2 $item] == -1} {
14 lappend firstonly
$item
16 lappend intersection
$item
21 if {[lsearch $intersection $item] == -1} {
22 lappend secondonly
$item
26 return [list $firstonly $intersection $secondonly]
29 proc tlc
::intersect3 {list1 list2
} {
34 set list1
[lsort -unique $list1]
35 set list2
[lsort -unique $list2]
38 if {[lsearch -sorted $list2 $item] == -1} {
39 lappend firstonly
$item
41 lappend intersection
$item
46 if {[lsearch -sorted $intersection $item] == -1} {
47 lappend secondonly
$item
52 return [list $firstonly $intersection $secondonly]
57 proc tlc
::afast_intersect3 {list1 list2
} {
62 set list1
[lsort -unique $list1]
63 set list2
[lsort -unique $list2]
72 if {[info exists b
($i)]} {
73 lappend intersection
$i
80 return [list $firstonly $intersection [array names b
]]