pattern matching

Computing Dictionary

pattern matching definition


1. A function is defined to take arguments of a particular type, form or value. When applying the function to its actual arguments it is necessary to match the type, form or value of the actual arguments against the formal arguments in some definition. For example, the function
length [] = 0 length (x:xs) = 1 + length xs
uses pattern matching in its argument to distinguish a null list from a non-null one.
There are well known algorithm for translating pattern matching into conditional expressions such as "if" or "case". E.g. the above function could be transformed to
length l = case l of [] -> 0 x:xs -> 1 : length xs
Pattern matching is usually performed in textual order though there are languages which match more specific patterns before less specific ones.
2. Descriptive of a type of language or utility such as awk or Perl which is suited to searching for strings or patterns in input data, usually using some kind of regular expression.
(1994-11-28)

The Free On-line Dictionary of Computing, © Denis Howe 2010 http://foldoc.org
Cite This Source

00:10

00:09

00:08

00:07

00:06

00:05

00:04

00:03

00:02

00:01

Pattern matching is always a great word to know.
So is slumgullion. Does it mean:
a stew of meat, vegetables, potatoes, etc.
a calculus or concretion found in the stomach or intestines of certain animals, esp. ruminants, formerly reputed to be an effective remedy for poison.
Dictionary.com, LLC. Copyright © 2012. All rights reserved.
  • Please Login or Sign Up to use the Recent Searches feature
FAVORITES
RECENT