Questions tagged [pattern-matching]
For questions about designing or implementing pattern matching, a language feature for inspecting values against patterns that describe groups of values
6 questions
10
votes
6
answers
2k
views
Distinguishing between constant patterns and binding patterns
Consider the following example in Rust:
...
9
votes
1
answer
388
views
What is the problem with bidirectional views?
In his original paper on Views for Pattern Matching, Philip Wadler describes them as bidirectional: the definition of a view had both in and ...
5
votes
1
answer
365
views
Earliest implementation of pattern matching as a programming language feature
As far as I can tell pattern matching was first proposed as a language feature by Burstall (1969). However, it was a proposal for a feature in the language ISWIM, which itself never had a completed ...
5
votes
1
answer
360
views
Is it possible to confirm that a pattern-matching statement is exhaustive when cases can be arbitrary predicates?
An algorithm to decide pattern match coverage can be complete by computing the complement for each case. For example:
Nat The primitive constructors are ...
7
votes
3
answers
627
views
Pros and cons of supporting "or patterns" in pattern matching
In some languages that support pattern matching, there is a feature that allows you to match against multiple patterns at once. This is called "or patterns" in Python 3.10. For example, you ...
0
votes
4
answers
287
views
What are some approaches for pattern matching? [closed]
How do different languages do pattern matching? In Rust it's
match x {
y => ...,
z => ...
}
However in ocaml it's
...