Prolog Language Data Structures Pairs


Example

By convention, the functor (-)/2 is often used to denote pairs of elements in Prolog. For example, the term -(A, B) denotes the pair of elements A and B. In Prolog, (-)/2 is defined as an infix operator. Therefore, the term can be written equivalently as A-B.

Many commonly available predicates also use this syntax to denote pairs. Examples of this are keysort/2 and pairs_keys_values/3.