To-do list for Pattern matching: edit · history · watch · refresh · Updated 2019-02-14
This is the talk page for discussing improvements to the Pattern matching article. This is not a forum for general discussion of the subject of the article.
This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.Computer scienceWikipedia:WikiProject Computer scienceTemplate:WikiProject Computer scienceComputer science
Pattern matching features of programming languages such as C#, C++, Rust, Swift, and SQL
Typing failure
Latest comment: 20 years ago1 comment1 person in discussion
"Pattern matching failure can often be ascribed to a type signature that is not strong enough or is incorrect."
I took that out because although I can imagine type signature can be blamed, I'm not at all assured that's a frequent or even reasonable cause. At least in Haskell, pattern type and expression type are statically checked to match. Perhaps if the type of a function is Maybe Integer -> Integer but giving Nothing as argument causes a matching failure, so the point would be the type should actually be Integer -> Integer? --82.181.66.6310:32, 18 August 2005 (UTC)Reply
Scope of this article
Latest comment: 16 years ago3 comments2 people in discussion
This article started as one about pattern matching in the ML family of programming languages. At some point a mention of Mathematica was added as an additional example. It's an interesting programming language, but not a general-purpose one, and its flavour of pattern matching is problematic as it's computationally expensive (NP-complete?). Thus I question whether the recent addition of the examples in Mathematica syntax and focus of discussion matter into regex-like features can keep the article focused. There already are articles about Mathematica and regexes, respectively, and their intersection might perhaps even warrant an article of its own. Be bold in your edits, but please include a comment, and discuss if you want to reach mutual understanding. --TuukkaH 22:54:17, 2005-09-03 (UTC)
Ok, this is still going into more general direction, I hope it works out well for an article with such an ambitious title :-) I just moved Mathematica and string pattern matching stuff into their own subsections. Now to make this more balanced, we would need at least:
a subsection about Snobol syntax
a short section and a see also to string patterns (regexes?)
I have a number of comments. First is that I think its a good idea to work together to make this a great section. However I respectfully disagree with the claims that Mathematica is not a general purpose language. I see it as an extremely general purpose language, that happens to also have a whole bunch of math functionality built it. (It is certainly as general purpose as ML or Haskell, and in some ways more so because of its graphics, import/export, and support for very wide array of programming constructs). It is true that the pattern matching in Mathematica is theoretically NP complete; yet in practice this is rarely an issue. Besides, I think it's good to cover pattern matching in all of its radically different flavors.
Perhaps we won't want to use the term general-purpose in this article then :-) There must be reasons why the programming language of Mathematica is without family. I can't but think it's designed as a scripting tool for symbolic mathematics, also built-in math already makes it special-purpose. Also, general-purpose is orthogonal with multi-paradigm. You do know that Haskell has been used to implement Perl 6 (Pugs), a revision-control system (Darcs) and an operating system with a graphical user-interface (House)? --TuukkaH16:57, 21 September 2005 (UTC)Reply
I think my concept for the article is to list a bunch of ways pattern matching can be used, and then show how 2-3 "paradigmatic" languages implement those ideas. In a way, my structure was an implicit challenge. Mathematica's use of pattern matching is quite frankly powerful and advanced, and I wanted to see if people could post examples in other languages of the same sorts of things. (I am happy to see that this challenge has been met in some of the places). But it is not unreasonable to organize it by language rather than by application of pattern matching. I agree that diagrams would be helpful. --Kovas
It should be clear by now that I would prefer Haskell as the general syntax and to absolutely keep info about Mathematica in. I start another thread below, because I'm starting to have a hard time thinking of all the organizational possibilities. --TuukkaH16:57, 21 September 2005 (UTC)Reply
Latest comment: 20 years ago2 comments1 person in discussion
Contents at the moment:
Primitive patterns
Tree patterns
Filtering data with patterns
Pattern matching in Mathematica
Declarative programming
Pattern matching and strings
Tree patterns for strings
Example string patterns
Contents from a previous version by Kevin:
Primitive patterns
Structure patterns
Pattern matching for user-defined types
Extracting data with patterns
Patterns for declarative programming
Pattern matching and Strings
Stuff I'd want to cover:
Important uses: function definitions, filtering and extraction, replacing (==rewriting?)
Languages: SNOBOL, Perl?, Mathematica, Haskell
Patterns: primitives, combination, regexes, trees, advanced features
History of pattern matching
Some of the language stuff can go to language-specific articles and some of the pattern stuff could go to a separate article about patterns if there are a lot of general features to discuss. --TuukkaH16:57, 21 September 2005 (UTC)Reply
So a tentative table of contents:
Patterns (primitive, in Haskell function definitions)
Latest comment: 18 years ago1 comment1 person in discussion
Pattern-matching is used by the human brain - it is one of our greatest strengths. One of the first things a baby masters is the visual tracking of human faces. But this article only mentions pattern-matching from the computer standpoint. Grassynoel09:03, 16 September 2007 (UTC)Reply
Incorrectly titled?
Latest comment: 18 years ago2 comments2 people in discussion
Seems like this article should be titled "Pattern matching in Haskell", not "Pattern matching".
Well, not really - it also talks about pattern matching in Mathematica...
I'm glad we all agree it should be titled something like "Pattern matching in obscure languages". For my part I would expect to see a pattern matching article mention things like Rete or Levensthein distance rather than deep dives into various peoples' favorite obscure languages. Hard to even give this article points for mentioning regular expressions because they're barely examined.
An article that treats a class of algorithms should be offering information about those algorithms and techniques in a language-agnostic sense, not losing the reader in the syntax and implementation details of an specific implementation language. -- Mikeblas17:11, 13 October 2007 (UTC)Reply
What is "language-agnostic" in the context of programming? The sort of pseudocode I've seen usually bears a striking resemblance to the favoured language of its progenitor (typically Pascal or C).
Should Wikipedia articles be written in a "natural language agnostic" sense, by avoiding the use of English? Should we invent a "pseudo-English", whose only purpose is to avoid losing readers in the details of actual English? I am being facetious, obviously, but there is a serious point to be made here. It's a bit too constraining to talk about programming without being able to present any actual source code.
Yes again you've nailed it. This should not be a programming centric article.
Could you be more specific about which pieces of the text you think go into the details of Haskell too much, in the context of this article?—greenrd19:34, 13 October 2007 (UTC)Reply
Disambiguation page
Latest comment: 14 years ago1 comment1 person in discussion
I've added a hatnote indicating this article (currently) concerns itself with pattern matching in functional programming languages, even though the lead does not accurately reflect this. "Pattern matching" is often used as a synonym for string matching and especially pattern recognition. Perhaps this should be turned into a disambiguation page instead? —Ruud12:02, 7 March 2012 (UTC)Reply
External links modified
Latest comment: 8 years ago1 comment1 person in discussion
Hello fellow Wikipedians,
I have just modified 8 external links on Pattern matching. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).
If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
If you found an error with any archives or the URLs themselves, you can fix them with this tool.
Latest comment: 1 year ago2 comments2 people in discussion
The article seems to be languishing and does not provide an overview of pattern matching is modern languages, where a common set of functionality is emerging -- it references a bunch of these (Scala, F#, Haskell) but the examples are too ML- and Mathematica-centric, and the Haskell example is hard to follow. Gvanrossum (talk) 04:32, 16 June 2020 (UTC)Reply
Indeed! There's so much left to say. Setting aside structural problems with the article as it stands, there are important things to say about irrefutability, exhaustiveness, complexity, prioritised vs nonintersecting alternatives and more, none of which are yet meaningfully addressed. Leastfixedpoint (talk) 08:42, 25 June 2025 (UTC)Reply
Split article?
Latest comment: 5 years ago3 comments2 people in discussion
As it stands now (and as has been mentioned several times over the years on this very talk page) the article is a bit schizophrenic.
@Tea2min: This article already has a disambiguation hatnote that explains that this article is about pattern matching in functional programming languages. Pattern matching in strings is also known as "string matching." Jarble (talk) 01:05, 28 May 2021 (UTC)Reply
@Jarble: Well, yes. I guess what I am trying to say is that "pattern matching in functional programming languages" may not the primary topic for the term "pattern matching", and furthermore, there is a whole section in the article talking about Pattern matching and strings ("By far the most common form of pattern matching involves strings of characters. ..."), so the article is not exclusively about pattern matching in functional programming languages. (Perhaps it's just that I find it confusing that big parts of the article talk about Mathematica.) – Tea2min (talk) 06:11, 28 May 2021 (UTC)Reply
Terminology: "scrutinee" vs "discriminant" vs other
Latest comment: 11 months ago1 comment1 person in discussion
My own preference is for "discriminant" but that term seems to be largely unknown to others; "scrutinee" is strongly preferred in the informal poll I took on Mastodon in June 2025 (respondents mostly CS academics with deep functional programming experience), and seems to be the term consistently used in e.g. Rust documentation, Wiktionary etc. Leastfixedpoint (talk) 09:21, 2 September 2025 (UTC)Reply
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.