Module Set
Class for a set.
This is an open structure, to make it easilly extensible. That is, the queue can be abused by manipulating it as an ordinary table. Items can be added to the set, but not removed. See also Wikipedias page on set.
Functions
set.new () | Create a new instance. |
set:add () | Add an item to the set. |
set:find () | Find an item in the set. |
set:isEmpty () | Is the set empty. |
set:count () | Count number of entries in set. |
Functions
- set.new ()
-
Create a new instance.
Parameters:
- ... vararg arguments to be passed on
Returns:
self - set:add ()
-
Add an item to the set.
This method can be called as a function.
Nicknames:
-
inject
Parameters:
- item any
Returns:
self - set:find ()
-
Find an item in the set.
This method can be called as a function.
Nicknames:
-
has
Parameters:
- item any
Returns:
any - set:isEmpty ()
-
Is the set empty.
Checks by counting items whether set is empty.
This method can be called as a function.
Returns:
boolean - set:count ()
-
Count number of entries in set.
This method can be called as a function.
Returns:
number