Code Snippet:
1
2
3
4
5
6
7
8
type FooBar = { foo : string; bar : int option }
[1 .. 10]
|> List.map(
fun x -> x % 2 = 0 |> function
| true -> { foo = "some"; bar = Some x }
| false -> { foo = "none"; bar = None } )
|> List.choose(fun x -> id x.bar)
Code output:
References:
- MSDN: List.choose