Seq.choose<'T,'U> Function (F#)
Applies the given function to each element of the list and returns the list comprised of the results for each element where the function returns Some with some value.
Namespace/Module Path: Microsoft.FSharp.Collections.Seq
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature: Seq.choose : ('T -> 'U option) -> seq<'T> -> seq<'U> // Usage: Seq.choose chooser source
The returned sequence may be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should not be accessed concurrently.
This function is named Choose in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
The following code example demonstrates the use of Seq.choose to select elements from a sequence by using a lambda expression that uses pattern matching to return an option type.
numbers = seq [1; 2; 3; 4; ...] evens = seq [2; 4; 6; 8; ...]