next up previous contents index
Next: Sorting Lists Up: Built-in predicates Previous: List Manipulation   Contents   Index

Set Manipulation

is_set1+Set Succeeds if Set is a proper list (see proper_list1) without duplicates. list_to_set2+List, -Set Unifies Set with a list holding the same elements as List in the same order. If list contains duplicates, only the first is retained. See also sort2. Example:
\begin{code}
?- list_to_set([a,b,a], X)
\par X = [a,b]
\end{code}

intersection3+Set1, +Set2, -Set3 Succeeds if Set3 unifies with the intersection of Set1 and Set2. Set1 and Set2 are lists without duplicates. They need not be ordered. subtract3+Set, +Delete, -Result Delete all elements of set `Delete' from `Set' and unify the resulting set with `Result'. union3+Set1, +Set2, -Set3 Succeeds if Set3 unifies with the union of Set1 and Set2. Set1 and Set2 are lists without duplicates. They need not be ordered. subset2+Subset, +Set Succeeds if all elements of Subset are elements of Set as well. merge_set3+Set1, +Set2, -Set3 Set1 and Set2 are lists without duplicates, sorted to the standard order of terms. Set3 is unified with an ordered list without duplicates holding the union of the elements of Set1 and Set2.


next up previous contents index
Next: Sorting Lists Up: Built-in predicates Previous: List Manipulation   Contents   Index
Dr. Richard Botting 2001-12-12