intersect

Command in the TclX pacakge to return the logical intersection of two lists. The returned list will be sorted.

Usage:

intersect lista listb

Example:

  package require Tclx
  intersect {a b c d e} {d e d f g c} ;# ==> c d e

This functionality exists in tcllib in the struct::set package.