protocol

setp

Set protocol.

Availability:
logtalk_load(sets(loader))
Author: Paulo Moura
Version: 2:0:0
Date: 2025-07-08
Compilation flags:
static
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

as_set/2

Returns a set with all unique elements from the given list.

Compilation flags:
static
Template:
as_set(List,Set)
Mode and number of proofs:
as_set(@list,-set) - one

as_list/2

Returns a list with all elements of the given set.

Compilation flags:
static
Template:
as_list(Set,List)
Mode and number of proofs:
as_list(@set,-list) - one

delete/3

Deletes an element from a set returning the set of the remaining elements.

Compilation flags:
static
Template:
delete(Set,Element,Remaining)
Mode and number of proofs:
delete(@set,@term,-set) - one

disjoint/2

True when the two sets have no element in common.

Compilation flags:
static
Template:
disjoint(Set1,Set2)
Mode and number of proofs:
disjoint(@set,@set) - zero_or_one

equal/2

True when the two sets are equal.

Compilation flags:
static
Template:
equal(Set1,Set2)
Mode and number of proofs:
equal(@set,@set) - zero_or_one

empty/1

True when the set is empty.

Compilation flags:
static
Template:
empty(Set)
Mode and number of proofs:
empty(@set) - zero_or_one

insert/3

Inserts an element in a set, returning the resulting set.

Compilation flags:
static
Template:
insert(In,Element,Out)
Mode and number of proofs:
insert(@set,@term,-set) - one

insert_all/3

Inserts all the elements of the list into a set, returning the resulting set.

Compilation flags:
static
Template:
insert_all(List,In,Out)
Mode and number of proofs:
insert_all(@list,@set,-set) - one

intersect/2

True if the two sets have at least one element in common.

Compilation flags:
static
Template:
intersect(Set1,Set2)
Mode and number of proofs:
intersect(@set,@set) - zero_or_one

intersection/3

Computes the intersection of Set1 and Set2.

Compilation flags:
static
Template:
intersection(Set1,Set2,Intersection)
Mode and number of proofs:
intersection(@set,@set,-set) - one

intersection/4

Computes the intersection and the difference between Set2 and Set1.

Compilation flags:
static
Template:
intersection(Set1,Set2,Intersection,Difference)
Mode and number of proofs:
intersection(@set,@set,-set,-set) - one

size/2

Number of set elements.

Compilation flags:
static
Template:
size(Set,Size)
Mode and number of proofs:
size(@set,?integer) - zero_or_one

member/2

Element is a member of set Set.

Compilation flags:
static
Template:
member(Element,Set)
Mode and number of proofs:
member(?term,+set) - zero_or_more

memberchk/2

True when a term is a member of a set.

Compilation flags:
static
Template:
memberchk(Element,Set)
Mode and number of proofs:
memberchk(@term,@set) - zero_or_one

powerset/2

Returns the power set of a set, represented as a list of sets.

Compilation flags:
static
Template:
powerset(Set,Powerset)
Mode and number of proofs:
powerset(@set,-list(set)) - one

product/3

Returns the cartesian product of two sets.

Compilation flags:
static
Template:
product(Set1,Set2,Product)
Mode and number of proofs:
product(@set,@set,-set) - one

select/3

Selects an element from a set, returning the set of remaining elements.

Compilation flags:
static
Template:
select(Element,Set,Remaining)
Mode and number of proofs:
select(?term,?set,?set) - zero_or_more

selectchk/3

True if an element can be selected from a set, returning the set of remaining elements.

Compilation flags:
static
Template:
selectchk(Element,Set,Remaining)
Mode and number of proofs:
selectchk(@term,@set,-set) - zero_or_one

subset/2

True if Subset is a subset of Set.

Compilation flags:
static
Template:
subset(Subset,Set)
Mode and number of proofs:
subset(@set,@set) - zero_or_one

subtract/3

Computes the set of all the elements of Set1 which are not also in Set2.

Compilation flags:
static
Template:
subtract(Set1,Set2,Difference)
Mode and number of proofs:
subtract(@set,@set,-set) - one

symdiff/3

Computes the symmetric difference of Set1 and Set2, containing all elements that are not in the sets intersection.

Compilation flags:
static
Template:
symdiff(Set1,Set2,Difference)
Mode and number of proofs:
symdiff(@set,@set,-set) - one

union/3

Computes the union of Set1 and Set2.

Compilation flags:
static
Template:
union(Set1,Set2,Union)
Mode and number of proofs:
union(@set,@set,-set) - one

union/4

Computes the union of Set1 and Set2 and the difference between Set2 and Set1.

Compilation flags:
static
Template:
union(Set1,Set2,Union,Difference)
Mode and number of proofs:
union(@set,@set,-set,-set) - one

Protected predicates

(none)

Private predicates

(none)

Operators

(none)

See also

set, set(Type)