Skip to main content
2 of 3
added 3 characters in body
Dan Bron
  • 28.5k
  • 17
  • 102
  • 139

To keep only those elements which match a predicate, you'd normally say "select" ("Give me the positive integers, and I will select the primes).

Both "filter" and "sift" (the verb corresponding to the noun "sieve"), as verbs, refer to the act (of separating wheat from chaff), not the result. When these words are used to describe or characterize results, they both can and have been applied to the parts kept (the wheat), and the parts discarded (the chaff).

If you specifically say "filter out", you are describing the elements you removed (discarded); if you say "filter for", you are describing the elements you retained (kept).

Dan Bron
  • 28.5k
  • 17
  • 102
  • 139