In the previous section we have been looking at basic functional structures that helps us write better programs. Now we're ready to move on to higher level constructs that let us organize our code functionally on a more abstract way.
Pattern matching is one of the killer features of F# that makes it a more attractive language than C# or Visual Basic. It could have been just a nice language feature for the built-in .NET types, but actually it is highly customizable and you can define your own patterns.
Here is how you can define your own active pattern:
// active pattern for sequences let (|Empty|NotEmpty|) sequence = if Seq.isEmpty sequence then Empty else NotEmpty sequence
This enables us to use the pattern directly ...