Introduction
Welcome to the seventh post in this introductory series on functional programming in F#. In this post we will be extending our knowledge of Pattern Matching by looking at how we can write our own matchers with Active Patterns. There are a number of different Active Patterns available but we will be concentrating on Partial & Multi-Case in this post.
Setting Up
All of the code can be written in F# script files (.fsx) and run using F# Interactive.
Partial Active Patterns
We are going to start with an old Interview favourite - FizzBuzz. Let's have a go at a simple solution;