Reference

Set

New

Input A list of elements.
Output A set containing the list of elements.

Signature

Example

Add

Input A set and a hashable element.
Output A new set containing the element.

Signature

Example

Remove

Input A set and a hashable element.
Output A new set without the element.

Signature

Example

Union

Input Two sets.
Output A new set containing all elements from both sets.

Signature

Example

Intersection

Input Two sets.
Output A new set containing only elements that are in both sets.

Signature

Example

Difference

Input Two sets.
Output A new set containing elements from the first set that are not in the second set.

Signature

Example

Contains

Input A set and a hashable element.
Output True if the set contains the element, false otherwise.

Signature

Example

Is Disjoint

Input Two sets.
Output True if the sets have no common elements, false otherwise.

Signature

Example

Is Empty

Input A set.
Output True if the set is empty, false otherwise.

Signature

Example

Is Not Empty

Input A set.
Output True if the set is not empty, false otherwise.

Signature

Example

Is Subset

Input Two sets.
Output True if the first set is a subset of the second set, false otherwise.

Signature

Example

Is Superset

Input Two sets.
Output True if the first set is a superset of the second set, false otherwise.

Signature

Example

Length

Input A set.
Output The number of elements in the set.

Signature

Example