4 |
2 |
HC4-4. Haskell Chapter 4 Practical Tasks ‐ Pattern Matching in Functions |
Pattern matching and Case expressions Outline Pattern matching in functions Catch-all patterns Closer look at lists Pattern matching Lists Tuples Case expressions Declaration style VS Expression style Pattern matching Pattern matching is the act of matching data (values, types, etc.) against a pattern, optionally binding variables to successful matches. We are going to discuss pattern matching in three cases: Pattern matching in function definitions. Pattern matching for lists. Pattern matching for tuples. It sounds complicated, but it_SingleQuote_s actually pretty intuitive when you get the hang of it. It_SingleQuote_ll be clear as day after a few examples. Let_SingleQuote_s pattern match some functions! |