Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.85.0/docs/_sources/setp_0.rst.txt

.. index:: setp .. _setp/0:

.. rst-class:: right

protocol

setp

Set protocol.

| Availability: | logtalk_load(sets(loader))

| Author: Paulo Moura | Version: 1:6:0 | Date: 2019-05-23

| Compilation flags: | static

| Dependencies: | (none)

| Remarks: | (none)

| Inherited public predicates: | (none)

.. contents:: :local: :backlinks: top

Public predicates

.. index:: as_set/2 .. _setp/0::as_set/2:

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


.. index:: as_list/2 .. _setp/0::as_list/2:

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


.. index:: delete/3 .. _setp/0::delete/3:

delete/3 ^^^^^^^^^^^^

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

| Compilation flags: | static

| Template: | delete(Set,Element,Remaining) | Mode and number of proofs: | delete(+set,@term,?set) - one


.. index:: disjoint/2 .. _setp/0::disjoint/2:

disjoint/2 ^^^^^^^^^^^^^^

True if 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


.. index:: equal/2 .. _setp/0::equal/2:

equal/2 ^^^^^^^^^^^

True if the two sets are equal.

| Compilation flags: | static

| Template: | equal(Set1,Set2) | Mode and number of proofs: | equal(+set,+set) - zero_or_one


.. index:: empty/1 .. _setp/0::empty/1:

empty/1 ^^^^^^^^^^^

True if the set is empty.

| Compilation flags: | static

| Template: | empty(Set) | Mode and number of proofs: | empty(+set) - zero_or_one


.. index:: insert/3 .. _setp/0::insert/3:

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


.. index:: insert_all/3 .. _setp/0::insert_all/3:

insert_all/3 ^^^^^^^^^^^^^^^^

Inserts a list of elements in 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


.. index:: intersect/2 .. _setp/0::intersect/2:

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


.. index:: intersection/3 .. _setp/0::intersection/3:

intersection/3 ^^^^^^^^^^^^^^^^^^

Returns the intersection of Set1 and Set2.

| Compilation flags: | static

| Template: | intersection(Set1,Set2,Intersection) | Mode and number of proofs: | intersection(+set,+set,?set) - zero_or_one


.. index:: intersection/4 .. _setp/0::intersection/4:

intersection/4 ^^^^^^^^^^^^^^^^^^

True if Intersection is the intersection of Set1 and Set2 and Difference is 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) - zero_or_one


.. index:: size/2 .. _setp/0::size/2:

size/2 ^^^^^^^^^^

Number of set elements.

| Compilation flags: | static

| Template: | size(Set,Size) | Mode and number of proofs: | size(+set,?integer) - zero_or_one


.. index:: member/2 .. _setp/0::member/2:

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_one | member(-term,+set) - zero_or_more


.. index:: memberchk/2 .. _setp/0::memberchk/2:

memberchk/2 ^^^^^^^^^^^^^^^

Checks if 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


.. index:: powerset/2 .. _setp/0::powerset/2:

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) - one


.. index:: product/3 .. _setp/0::product/3:

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


.. index:: select/3 .. _setp/0::select/3:

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


.. index:: selectchk/3 .. _setp/0::selectchk/3:

selectchk/3 ^^^^^^^^^^^^^^^

Checks that 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


.. index:: subset/2 .. _setp/0::subset/2:

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


.. index:: subtract/3 .. _setp/0::subtract/3:

subtract/3 ^^^^^^^^^^^^^^

True when Difference contains all and only 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) - zero_or_one


.. index:: symdiff/3 .. _setp/0::symdiff/3:

symdiff/3 ^^^^^^^^^^^^^

True if Difference is 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) - zero_or_one


.. index:: union/3 .. _setp/0::union/3:

union/3 ^^^^^^^^^^^

True if Union is the union of Set1 and Set2.

| Compilation flags: | static

| Template: | union(Set1,Set2,Union) | Mode and number of proofs: | union(+set,+set,?set) - zero_or_one


.. index:: union/4 .. _setp/0::union/4:

union/4 ^^^^^^^^^^^

True if Union is the union of Set1 and Set2 and Difference is 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) - zero_or_one


Protected predicates

(none)

Private predicates

(none)

Operators

(none)

.. seealso::

:ref:`set <set/0>`, :ref:`set(Type) <set/1>`