Pattern matching: Difference between revisions

Content deleted Content added
m External links: archive link repair, may include: archive.* -> archive.today, and http->https for ghostarchive.org and archive.org
Citation bot (talk | contribs)
Alter: title. | Use this bot. Report bugs. | Suggested by EthanGaming7640 | Category:Pattern matching | #UCB_Category 3/33
Line 7:
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]],<ref>[http://www.haskell.org/tutorial/patterns.html A Gentle Introduction to Haskell: Patterns]</ref> [[ML programming language|ML]], [[Python (programming language)|Python]],<ref>{{Cite web|title=What’sWhat's New In Python 3.10 — Python 3.10.0b3 documentation|url=https://docs.python.org/3.10/whatsnew/3.10.html#pep-634-structural-pattern-matching|access-date=2021-07-06|website=docs.python.org}}</ref> [[Ruby (programming language)|Ruby]],<ref>{{Cite web|title=pattern_matching - Documentation for Ruby 3.0.0|url=https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html|access-date=2021-07-06|website=docs.ruby-lang.org}}</ref> [[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]],<ref>{{Cite web|title=Pattern Matching|url=https://docs.scala-lang.org/tour/pattern-matching.html|access-date=2021-01-17|website=Scala Documentation}}</ref> [[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.
 
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}}