Pattern matching: Difference between revisions

Content deleted Content added
m linking
This line was marked "citation needed", but should be omitted altogether because it's related to the general topic, but has nothing to do with the paragraph that it's in.
Tags: Mobile edit Mobile web edit
Line 6:
Sequence patterns (e.g., a text string) are often described using [[regular expression]]s and matched using techniques such as [[backtracking]].
 
Tree patterns are used in some [[programming language]]s as a general tool to process data based on its structure, e.g. [[C Sharp (programming language)|C#]],<ref>{{cite web|url=https://docs.microsoft.com/en-us/dotnet/csharp/pattern-matching|title=Pattern Matching - C# Guide}}</ref> [[F Sharp (programming language)|F#]],<ref>{{cite web|url=https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching|title=Pattern Matching - F# Guide}}</ref> [[Haskell (programming language)|Haskell]], [[ML programming language|ML]], [[Rust (programming language)|Rust]],<ref>{{cite web |url=https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html |title=Pattern Syntax - The Rust Programming language}}</ref> [[Scala programming language|Scala]], [[Swift (programming language)|Swift]]<ref>{{cite web|url=https://docs.swift.org/swift-book/ReferenceManual/Patterns.html|title=Patterns — The Swift Programming Language (Swift 5.1)}}</ref> and the symbolic mathematics language [[Mathematica]] have special syntax for expressing tree patterns and a [[language construct]] for [[Conditional (programming)|conditional execution]] and value retrieval based on it. For simplicity and efficiency reasons, these tree patterns lack some features that are available in regular expressions.{{citation needed|date=June 2019}}
 
Often it is possible to give alternative patterns that are tried one by one, which yields a powerful [[Conditional (programming)|conditional programming construct]]. Pattern matching sometimes includes support for [[guard (computing)|guards]].{{citation needed|date=January 2019}}