...
Operation | Description | Syntax | Example | Result Value | Result Type |
---|---|---|---|---|---|
mkset or {} | creates a set from elements | mkset (ele_1, ... ,ele_n) | mkset (1.33,2,3,4) | {1.33, 2, 3, 4} | set(float) |
isempty | Checks if a set is empty | isempty (set) | isempty ({1, 2, 3}) | false | bool |
length | Returns the length of a set | length (set) | length ({1, 20, 3, 4, 20, 20}) | 4 | int |
size | Returns the length of a set | size (set) | size ({1, 20, 3, 4, 20, 20}) | 4 | int |
has (->) | Checks the occurrence of | has (set, ele) | has ({31, 2, 77}, 77) | true | bool |
in (<-) | Checks the occurrence of | `in` (ele, set) | `in` (77, {30, 2, 77}) | true | bool |
has (->) | Checks whether a set | has (set_1, set_2) | has ({1, 2 , 3, 4}, {2, 1}) | true | bool |
in (<-) | Checks whether a set | `in` (set_1, set_2) | `in` ({1, 2 , 3, 4}, {2, 1}) | false | bool |
add (+) | Adds some value to a set | add (set, ele) | add ({30, "Peter", 77}, “Ann") | {30, Peter, 77, Ann} | set(str) |
add (+) | Union of two sets | add (set_1, set_2) | add ({5, "Peter", 77}, {77, "Ann", 400}) | {5, Peter, 77, Ann, 400] | set(str) |
join * | Joins the strings of a given | join (set_str) | join ({1, "Peter", 77, 77, "Ann"}) | 1Ann77Peter | str |
band | Intersection of two sets | band (set_1, set_2) | band ({30, 2, 77}, {77, 400}) | {77} | set(int) |
sub (-) | Deletes a value from a set | sub (set, ele) | sub ({30, 2, 77}, 400) | {30, 2, 77} | •set(int) |
sub (-) | Difference of two sets | sub (set_1, set_2) | sub ({30, 2, 77}, {400, 30}) | {2, 77} | set(int) |
...