Commands: type any of these commands, or a combination of commands, and
the result is printed.
literal: element, set, ( command )
This consists of either an element, a set, or a parenthesized expression.
The result will determine the type of the literal and what context it
can be used in.
element:
This is either a number, a double quoted string, a set, or a literal
which evaluates to any of these types.
set:
{ } for the null set, or { element1, ..., elementN }, or a literal
which evaluates to a set. Sets can contain elements of different types,
ie, {1, "hello", {5, 6}}
assignment: ` :
This will assign the result of to variable ``, which
should be a single letter (case is insensitive). This variable will
take the type of whatever literal is (ie, a set, a number, etc), and
can be used wherever that type is expected.
set + set: The union of two sets. Result is a set.
set ^ set: The intersection of two sets. Result is a set.
set - set: The difference of two sets. Result is a set.
set / set: The symmetric difference of two sets. Result is a set.
@ set: The powerset of a set. Result is a set.
Note: for the following tests, the number is 0 if false, 1 if true.
set1 <= set2: Test if set1 is a subset of set2. Result is a number.
set1 < set2: Test if set1 is a proper subset of set2. Result is a number.
set1 = set2: Test if set1 and set2 are equal. Result is a number.
set1 != set2: Test if set1 and set2 are not equal. Result is a number.
element [ set: Test if element is contained in set. Result is a number.
element ![ set: Test if element is not in set. Result is a number.
|set|: Get the size of a set. Result is a number.
Example commands: (lines beginning with > are the input, the rest is output)
> a:{1, 2, 3}
{1, 2, 3}
> b:{2, 3, 4}
{2, 3, 4}
> a + b
{1, 2, 3, 4}
> a - b
{1}
> a ^ b
{2, 3}
> a / b
{1, 4}
> a < (a+b)
1
> {1, 2} - ({1} + {2})
{}
> S : {1, 2, "hello"}
{1, 2, hello}
> N : |S|
3
> {N, 5}
{3, 5}
> S - {"hello"}
{1, 2}
> S + {1, 5}
{1, 2, hello, 5}
> "hello" [ S
1
> S <= S
1
> S < S
0
> {1, 2} <= S
1
> {1, 2} < S
1
> P : @S
{{}, {1}, {2}, {hello}, {1, 2}, {1, hello}, {2, hello}, {1, 2, hello}}
> S [ P
1
> |P|
8
> P - {S}
{{}, {1}, {2}, {hello}, {1, 2}, {1, hello}, {2, hello}}
> |P - {S}|
7
`