RosettaCodeData/Task/Set/Maple/set.maple

42 lines
1.1 KiB
Plaintext

> S := { 2, 3, 5, 7, 11, Pi, "foo", { 2/3, 3/4, 4/5 } };
S := {2, 3, 5, 7, 11, "foo", Pi, {2/3, 3/4, 4/5}}
> type( S, set );
true
> Pi in S;
Pi in {2, 3, 5, 7, 11, "foo", Pi, {2/3, 3/4, 4/5}}
> if Pi in S then print( yes ) else print( no ) end:
yes
> member( Pi, S );
true
> if 4 in S then print( yes ) else print( no ) end:
no
> evalb( { 2/3, 3/4, 4/5 } in S );
true
> { a, b, c } union { 1, 2, 3 };
{1, 2, 3, a, b, c}
> { a, b, c } intersect { b, c, d };
{b, c}
> { a, b, c } minus { b, c, d };
{a}
> { a, b } subset { a, b, c };
true
> { a, d } subset { a, b, c };
false
> evalb( { 1, 2, 3 } = { 1, 2, 3 } );
true
> evalb( { 1, 2, 3 } = { 1, 2, 4 } );
false