Version 0 of Unique Element List

Updated 2010-07-16 19:34:15 by CJB

CJB: Returns the list without duplicate elements. This is different from lsort -unique in that it maintains the list ordering. It also keeps the first element encountered and removes subsequent callings.


 proc uniqueList {list} {
   set new {}
     foreach item $list {
       if {[lsearch $new $item] < 0} {
         lappend new $item
       }
     }
   return $new
 }