Please log in to watch this conference skillscast.
Pattern matching is widely used in functional languages to support ‘programming by cases.’ Common patterns such as tuples and discriminated unions are usually built into the language, but with F# active patterns you can extend pattern matching with your own classification and destructuring logic, capturing chains of if-else-else logic in a readable, reusable abstraction.
In this talk, we’ll take a tour of the various active pattern techniques available in F#, including cases, conditions and parameterised patterns. We’ll explore how to define each kind of active pattern, how to use it in a match expression and where you might apply it in your code.
YOU MAY ALSO LIKE:
Beyond Conditionals: Active Patterns in F#
Ivan Towlson
Lecturer Department of Computing at Macquarie University in Sydney