Did you know ... Search Documentation:
sets.pl -- SICStus 4 library(sets).
PublicShow source
See also
- https://sicstus.sics.se/sicstus/docs/4.6.0/html/sicstus.html/lib_002dsets.html
To be done
- This library is incomplete. As of SICStus 4.6.0, the following predicates are missing:
Source list_to_set(+List, -Set) is det
Set is List with all duplicates removed. Duplicates are removed by unification. This is not the same as SWI-Prolog's list_to_set/2 in library(lists), which finds duplicates based on term equality (==).
Compatibility
- SICStus 4

Re-exported predicates

The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.

Source is_set(@Set) is semidet
True if Set is a proper list without duplicates. Equivalence is based on ==/2. The implementation uses sort/2, which implies that the complexity is N*log(N) and the predicate may cause a resource-error. There are no other error conditions.
Source intersection(+Set1, +Set2, -Set3) is det
True if Set3 unifies with the intersection of Set1 and Set2. The complexity of this predicate is |Set1|*|Set2|. A set is defined to be an unordered list without duplicates. Elements are considered duplicates if they can be unified.
See also
- ord_intersection/3.
Source union(+Set1, +Set2, -Set3) is det
True if Set3 unifies with the union of the lists Set1 and Set2. The complexity of this predicate is |Set1|*|Set2|. A set is defined to be an unordered list without duplicates. Elements are considered duplicates if they can be unified.
See also
- ord_union/3
Source subset(+SubSet, +Set) is semidet
True if all elements of SubSet belong to Set as well. Membership test is based on memberchk/2. The complexity is |SubSet|*|Set|. A set is defined to be an unordered list without duplicates. Elements are considered duplicates if they can be unified.
See also
- ord_subset/2.
Source subtract(+Set, +Delete, -Result) is det
Delete all elements in Delete from Set. Deletion is based on unification using memberchk/2. The complexity is |Delete|*|Set|. A set is defined to be an unordered list without duplicates. Elements are considered duplicates if they can be unified.
See also
- ord_subtract/3.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source seteq(Arg1, Arg2)
Source disjoint_union(Arg1, Arg2, Arg3)
Source set_order(Arg1, Arg2, Arg3)
Source intersect(Arg1, Arg2)
Source del_element(Arg1, Arg2, Arg3)
Source disjoint(Arg1, Arg2)
Source add_element(Arg1, Arg2, Arg3)
Source union(Arg1, Arg2, Arg3, Arg4)