The alternative syntax for anonymous function performing matching

F# offers a special syntax to define anonymous functions that perform matching, or pattern matching functions (https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/match-expressions).

This syntax assumes that the anonymous function has a single parameter that is placed at the beginning of the function body in the invisible match construction. Having this alternative way of defining pattern matching anonymous functions just adds to the language succinctness and also better reflects the intent behind defining such kind of functions within the code.

Continuing with coding exercises, in the latest F# script I will rewrite the validate function using the alternative ...

Get F# 4.0 Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.