Abstract
In this chapter we discuss the many locations in F# code where we can use pattern matching. We can pattern match explicitly using the match keyword, but also in let bindings, loops, lambdas, and function declarations. Active Patterns add a whole new layer of power, letting you map from somewhat open-ended data to much more strongly-typed classifications. We also note that pattern matching can be overdone, leading to unreadable code. We establish some criteria to help decide when to use the various pattern matching features.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
No horrific fall-through semantics, as in C!
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Kit Eason
About this chapter
Cite this chapter
Eason, K. (2018). Pattern Matching. In: Stylish F#. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4000-7_6
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4000-7_6
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3999-5
Online ISBN: 978-1-4842-4000-7
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)