YASL’s collections library defined the following functions.
Name | Arguments | Description |
---|---|---|
set | args… | Returns a set containing args. |
list | args… | Alternate constructor for lists. |
table | args… | Alternate constructor for tables. |
Name | Arguments | Description |
---|---|---|
tostr | self | Returns a string representation of self. |
tolist | self | Creates a new list containing all the elements of self, in arbitrary order. |
add | self, val | Updates self to contain val. |
remove | self, val | Removes val from self. |
copy | self | Creates a copy of self. |
clear | self | Removes all elements from self. |
contains | self, val | Returns true if val is in self, otherwise false. |
Operator | Operands | Description |
---|---|---|
& | left, right | Set intersection of left and right. |
| | left, right | Set union of left and right. |
^ | left, right | Symmetric set difference of left and right. |
&^ | left, right | Set difference of left and right. |
len | set | Cardinality of set. |
< | left, right | Checks left is a strict subset of right. |
<= | left, right | Checks left is a subset of right. |
> | left, right | Checks left is a strict superset of right. |
>= | left, right | Checks left is a superset of right. |
== | left, right | Checks left is equal to right. |
!= | left, right | Checks left is not equal to right. |