DELAPARRA
Index
Color
NL
Category: Programming paradigms

Unification

Explained by Updated

What is Unification?

Unification: Matching a query against facts/rules by binding variables so both sides become identical. Unification is the matching process at the heart of logic programming. To answer a query, the engine tries to make the query and a fact or rule identical by assigning values to variables. Matching parent(alice, X) with the fact parent(alice, bob) succeeds by binding X to bob. If no binding makes both sides the same, unification fails and the engine backtracks to try something else.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Unification

What should you keep in mind with Unification?

The same idea appears outside Prolog. Type inference in languages like Haskell, TypeScript and Rust uses unification to work out types you did not write. Pattern matching in modern languages, such as match in Rust or destructuring in JavaScript, is a simpler cousin: you describe a shape, and the language checks the value against it and extracts the parts.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with U

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.