Code: Select all
proc lremove { list what } {
while { [set pos [lsearch -exact $list $what]] != -1 } {
set list [lreplace $list $pos $pos]
}
return $list
}
# example:
# set list "aa bb cc"
# set list [lremove $list "bb"] will set list to "aa cc"
# example:
# set staticList {aa bb cc dd ee}
# set dynamicList {bb cc dd ee}
Now we need to remove aa from staticList as its not present in dynamicList what are the possibilities.
Sorry for my previous post I didn't make much sense and moved my post from Tcl Faq where proc lremove was posted by Sky to Tcl Help I think it best fits here.