hi all,
set a '1 2 3 '
set b ' 4 1 3 8 2'
i need to compare these two lists ...not on the basis of order of arrangement only difference
output i need is 4 8
i tried using using *markintersection its not working
Hi
*markintersection is used for hm entities only.
a proc like this
proc ::ldiff {list1 list2} {
set result {}
foreach item $list1 {if {[lsearch $list2 $item]==-1} {lappend result $item}}
set result
}
#now call
ldiff $b $a
hi tinh ,
ya this is working....in case if we have
set a '1 2 3'
set b '1 3 4'
out put
2 4
in this case we have to loop both the lists and append in a separate list . ryt?
just try it and show us your results
chào Tĩnh, mình mới học về hypermesh và đang muốn viết script cho hypermesh, bạn học về hypermesh à /emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />
hi tinh,
in the code which u have written ,what does set result does.?(after the for loop)
it returns result.
i think it is not neccessary. because lappend will return it
could you remove it and try?
no no, it is needed. because sometimes lsearch not found item, it will return emptied string