Pattern matching

/ˈpætərn ˈmætʃɪŋ/ noun

Definition

A programming construct that checks data against specified patterns and extracts values when matches are found. It combines conditional logic with data destructuring in a single, expressive syntax.

Etymology

Derived from mathematical pattern recognition and formal language theory, first implemented in programming languages like ML in the 1970s. The term combines 'pattern' (from Latin 'patronus' meaning model) with 'matching' (from Old English 'gemæcca' meaning mate or equal), emphasizing the process of finding structural correspondence.

Kelly Says

Pattern matching is like having X-ray vision for data structures - instead of manually checking 'is this a list? does it have elements? what's the first element?', you can write one line that says 'if this looks like [first, ...rest], then do this with first and rest!' It makes complex data handling read like natural language.

Related Words

Explore More Words

Get the Word Orb API

Complete word intelligence in one call. Free tier — 50 lookups/day.