liveBook · Manning

List.filter

As explained in F# in Action: A Revised Edition of Get Programming with F#

List.filter is an F# library function that retains list elements satisfying a predicate function.

List.filter is an F# library function that retains the elements of a list that satisfy a predicate function. It belongs to the List module, which provides common operations for processing lists. section 7.2.3 section 7.2.4

Use filtering when a list must be reduced to matching items rather than transformed into a different shape. Call the function through the List module, and read its signature before combining it with other collection functions. section 7.2.3 section 7.2.4

Practical habits make List.filter easier to use:

  • Treat filter as one operation in a larger collection-processing pipeline. section 7.2.4
  • Inspect function signatures instead of randomly plugging collection functions together. section 7.2.3
  • Practice related operations such as map, collect, groupBy, partition, skip, and take until their combinations become familiar. section 7.2.4

How F# in Action: A Revised Edition of Get Programming with F# covers it

How deep it goes
Defines filtering and places it among common List operations, without detailing predicate evaluation or a complete signature.
Examples
Names filter alongside map, collect, skip, take, sort, groupBy, windowed, and partition as common List operations.
What it assumes
Teaches readers to read collection-function signatures step by step, but does not specify broader prerequisite knowledge.
What you can do after
Apply filtering through the F# List module and combine it with other collection functions after practicing signatures.
How it connects
Connects filtering with the List module, higher-order functions, collection processing, map, partition, and LINQ-style libraries.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of F# in Action: A Revised Edition of Get Programming with F#. The section links point to the parts of the book it draws on.