Skip to main content
Book cover

Stylish F# pp 119–155Cite as

Apress

Pattern Matching

  • Chapter
  • First Online:
  • 580 Accesses

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    No horrific fall-through semantics, as in C!

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Kit Eason

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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

Publish with us

Policies and ethics