tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
39
Task/Set/Icon/set-2.icon
Normal file
39
Task/Set/Icon/set-2.icon
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
link sets
|
||||
|
||||
procedure main ()
|
||||
a := set(1, 1, 2, 3, 4)
|
||||
b := set(2, 3, 5)
|
||||
write ("a: ", simage(a))
|
||||
write ("b: ", simage(b))
|
||||
# basic set operations
|
||||
write ("Intersection: ", simage (a**b))
|
||||
write ("Union: ", simage (a++b))
|
||||
write ("Difference: ", simage (a--b))
|
||||
# membership
|
||||
if member(a, 2) then
|
||||
write ("2 is a member of a")
|
||||
else
|
||||
write ("2 is not a member of a")
|
||||
if member(a, 5) then
|
||||
write ("5 is a member of a")
|
||||
else
|
||||
write ("5 is not a member of a")
|
||||
# equality
|
||||
if seteq(a, set(1,2,3,4,4)) then
|
||||
write ("a equals set(1,2,3,4,4)")
|
||||
else
|
||||
write ("a does not equal set(1,2,3,4,4)")
|
||||
if seteq(a, b) then
|
||||
write ("a equals b")
|
||||
else
|
||||
write ("a does not equal b")
|
||||
# check subset
|
||||
if setlt(set(1,2), a) then
|
||||
write ("(1,2) is included in a")
|
||||
else
|
||||
write ("(1,2) is not included in a")
|
||||
if setlt(a, set(1,2,5), a) then
|
||||
write ("(1,2,5) is included in a")
|
||||
else
|
||||
write ("(1,2,5) is not included in a")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue