The list operator is used to separate the head of a list from the tail of a list. The head of a list may consist of several terms.The list operator is usually used to get the first element and the remainder of a list during unification. The right operand of the list operator is considered a list during unification. It is a predefined infix operator, priority is 1000 and it is right associative (xfy).
| Examples | |
| member( X, [X | Tail] ). | If the goal is 'member(a, [a, b, c]).' then this
goal succeeds; X = a Tail = [b, c] |
| member( X, [X | Tail] ). | If the goal is 'member(a, [a]).' then this goal
succeeds; X = a Tail = [] |