Pattern Matching in Languages

Discussions revolve around pattern matching features in programming languages like Rust, Haskell, Python, Scala, and others, comparing it to switch statements, debating its usefulness, syntax, and implementations.

📉 Falling 0.5x Programming Languages
3,556
Comments
20
Years Active
5
Top Authors
#6958
Topic ID

Activity Over Time

2007
2
2008
8
2009
44
2010
54
2011
57
2012
80
2013
99
2014
227
2015
151
2016
191
2017
223
2018
292
2019
236
2020
338
2021
449
2022
241
2023
343
2024
253
2025
258
2026
10

Keywords

OO matching.html e.g IN ML reddit.com github.io pattern matching matching pattern haskell match prolog rust elixir erlang language

Sample Comments

Kiro Jul 30, 2019 View on HN

What's the point of pattern matching? Why not just a switch statement?

epse Jul 27, 2020 View on HN

It doesn't really pattern match like rust, but it's still very useful

WhereIsTheTruth Dec 30, 2023 View on HN

Depends on the language, looks like this one can't do pattern matching? Makes you appreciate languages like Zig, Rust or Odin a lot more

atroche Sep 22, 2019 View on HN

Pattern matching syntax (eg in Rust) makes a big difference.

shrubble Feb 21, 2024 View on HN

Are you using pattern matching in the sense of Standard ML and the ML family of languages?

phnofive Feb 11, 2021 View on HN

match credulity: case woosh: print(“We were starting to worry that we would run out of major language changes to confuse new developers. But thanks to pattern matching, we should be set for another 5-7 years! ”)

StreamBright Jan 16, 2018 View on HN

Have you seen Reason yet? It has pattern matching.https://reasonml.github.io/docs/en/pattern-matching.html

involans Feb 9, 2021 View on HN

This is pattern matching. Support for this exists in Haskell, Scala, and now even Ruby and soon Python.

illiarian Mar 22, 2023 View on HN

Like any language with pattern matching. See Erlang, Haskell etc.

eat_veggies Dec 13, 2020 View on HN

Is pattern matching a generalization of if/then/else, a reframing of it, or something else entirely?