Name

filter — Filter a list.

Synopsis

filter list varname script

Description

The filter command takes a list and filters it according to the code provided in code. The current element of the list being considered is stored in the varname provided. A list of 'matches' is returned.

Example

set lst {1 2 3 4 5 4 3 2 1}
puts [filter $lst x {= $x 4}]
	  

Produces:

4 4