Class std.set
Set container.
Derived from std.container, and inherits Container's metamethods.
Note that Functions listed below are available only available from the Set prototype returned by requiring this module, because Container objects cannot have object methods.
Functions
std.set.delete (set, e) | Delete an element from a set. |
std.set.difference (set1, set2) | Find the difference of two sets. |
std.set.elems (set) | Iterator for sets. |
std.set.equal (set1, set2) | Find whether two sets are equal. |
std.set.insert (set, e) | Insert an element into a set. |
std.set.intersection (set1, set2) | Find the intersection of two sets. |
std.set.member (set, e) | Say whether an element is in a set. |
std.set.proper_subset (set1, set2) | Find whether one set is a proper subset of another. |
std.set.subset (set1, set2) | Find whether one set is a subset of another. |
std.set.symmetric_difference (set1, set2) | Find the symmetric difference of two sets. |
std.set.union (set1, set2) | Find the union of two sets. |
Tables
std.set | Set prototype object. |
Metamethods
std.set.__add (set, table) | Union operator. |
std.set.__div (set, table) | Symmetric difference operator. |
std.set.__le (set, table) | Subset operator. |
std.set.__lt (set, table) | Proper subset operator. |
std.set.__mul (set, table) | Intersection operator. |
std.set.__sub (set, table) | Difference operator. |
Functions
- std.set.delete (set, e)
-
Delete an element from a set.
Parameters:
- set set a set
- e element
Returns:
-
the modified set
- std.set.difference (set1, set2)
-
Find the difference of two sets.
Parameters:
Returns:
set1
with elements of s removed - std.set.elems (set)
-
Iterator for sets.
Parameters:
- set set a set
- std.set.equal (set1, set2)
-
Find whether two sets are equal.
Parameters:
Returns:
true
ifset1
andset2
are equal,false
otherwise - std.set.insert (set, e)
-
Insert an element into a set.
Parameters:
- set set a set
- e element
Returns:
-
the modified set
- std.set.intersection (set1, set2)
-
Find the intersection of two sets.
Parameters:
Returns:
-
set intersection of
set1
andset2
- std.set.member (set, e)
-
Say whether an element is in a set.
Parameters:
- set set a set
- e element
Returns:
true
ife
is in set , otherwisefalse
otherwise - std.set.proper_subset (set1, set2)
-
Find whether one set is a proper subset of another.
Parameters:
Returns:
true
ifset1
is a proper subset ofset2
,false
otherwise - std.set.subset (set1, set2)
-
Find whether one set is a subset of another.
Parameters:
Returns:
true
ifset1
is a subset ofset2
,false
otherwise - std.set.symmetric_difference (set1, set2)
-
Find the symmetric difference of two sets.
Parameters:
Returns:
-
elements of
set1
andset2
that are inset1
orset2
but not both - std.set.union (set1, set2)
-
Find the union of two sets.
Parameters:
Returns:
-
set union of
set1
andset2
Tables
- std.set
-
Set prototype object.
Fields:
- _init table or function a table of field names, or initialisation function, see std.object.__call
- _functions nil or table a table of module functions not copied by std.object.__call
- _type string type of Set, returned by std.object.prototype (default "Set")
Metamethods
- std.set.__add (set, table)
-
Union operator.
union = set + table
Parameters:
Returns:
-
set
union
See also:
- std.set.__div (set, table)
-
Symmetric difference operator.
symmetric_difference = set / table
Parameters:
Returns:
-
set
symmetric_difference
See also:
- std.set.__le (set, table)
-
Subset operator.
set = set <= table
Parameters:
Returns:
-
set
subset
See also:
- std.set.__lt (set, table)
-
Proper subset operator.
proper_subset = set < table
Parameters:
Returns:
-
set
proper_subset
See also:
- std.set.__mul (set, table)
-
Intersection operator.
intersection = set * table
Parameters:
Returns:
-
set
intersection
See also:
- std.set.__sub (set, table)
-
Difference operator.
difference = set - table
Parameters:
Returns:
-
set
difference
See also: