Measures Concepts
GitHub icon

Pattern Matching

Pattern Matching - language feature

< >
Example from Haskell:
fib 0 = 1 fib 1 = 1 fib n | n >= 2 = fib (n-1) + fib (n-2)
Example from Elixir:
def fib(0), do: 1 def fib(1), do: 1 def fib(n) when n >= 2, do: fib(n-1) + fib(n-2)
Example from Coconut:
match [head] + tail in [0, 1, 2, 3]: print(head, tail)
Example from Felix:
match x with | Some x => println$ x; | None => println "NONE"; endmatch;
Example from Aardvark:
This functionality is included in switch statements.

Languages with Pattern Matching include Rust, Haskell, Elixir, Coconut, HOPE, Felix, Aardvark, Egison, NPL

Languages without Pattern Matching include progsbase

This question asks: Does the language support pattern matching?

Read more about Pattern Matching on the web: 1.

HTML of this page generated by Features.ts

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Queries Stats Sponsor Day 605 feedback@pldb.io Logout