Version: 1.5#118 (2000/4/19, 18:13:43 CEST)
Version of last change: 0.9#17 (1999/3/23, 20:57:20 MET)
This module implements set operations. Sets are just ordered lists.
sets):- use_module(library(sets)).
sets)
Usage: insert(+Set1,+Element,-(Set2))
Set2 is Set1 with Element inserted in it, preserving the order.
Usage: ord_delete(+Set0,+X,-(Set))
Set is Set0 without element X.
Usage: ord_member(+X,+Set)
X is member of Set.
Usage: ord_test_member(+Set,+X,-(Result))
X is member of Set then Result=yes. Otherwise Result=no.
Usage: ord_subtract(+Set1,+Set2,?(Difference))
Difference contains all and only the elements of Set1 which are not also in Set2.
Usage: ord_intersection(+Set1,+Set2,?(Intersection))
Intersection is the ordered representation of Set1 and Set2, provided that Set1 and Set2 are ordered lists.
Usage: ord_intersection_diff(+Set1,+Set2,-(Intersect),-(NotIntersect))
Intersect contains those elements which are both in Set1 and Set2, and NotIntersect those which are in Set1 but not in Set2.
Usage: ord_intersect(+Xs,+Ys)
Usage: ord_subset(+Xs,+Ys)
Xs appears in Ys.
Usage: ord_subset_diff(+Set1,+Set2,-(Difference))
Set1 appears in Set2 and Difference has the elements of Set2 which are not in Set1.
Usage: ord_union(+Set1,+Set2,?(Union))
Union is the union of Set1 and Set2. When some element occurs in both sets, Union retains only one copy.
Usage: ord_union_diff(+Set1,+Set2,-(Union),-(Difference))
Union is the union of Set1 and Set2, and Difference is Set2 set-minus Set1.
Usage: ord_union_symdiff(+Set1,+Set2,-(Union),-(Diff))
Usage: ord_union_change(+Set1,+Set2,-(Union))
Union is the union of Set1 and Set2 and Union is different from Set2.
Usage: merge(+Set1,+Set2,?(Union))
ord_union/3.
Usage: ord_disjoint(+Set1,+Set2)
Set1 and Set2 have no element in common.
Usage: setproduct(+Set1,+Set2,-(Product))
Product has all two element sets such that one element is in Set1 and the other in set2, except that if the same element belongs to both, then the corresponding one element set is in Product.
Go to the first, previous, next, last section, table of contents.