Pairs in Prolog

Опубликовано: 21 Июнь 2026
на канале: The Power of Prolog
4,321
94

A pair is a term with principal functor (-)/2. Pairs are used in the standard predicate keysort/2, and many Prolog systems provide additional predicates for reasoning about pairs. For example, Scryer Prolog ships with library(pairs): https://github.com/mthom/scryer-prolo... Depending on the application, other functor names are sometimes more suitable to represent pairwise combinations of terms. However, only terms with principal functor "-" and two arguments are called pairs in the sense of the Prolog ISO standard.