Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
65
Task/Set/Diego/set.diego
Normal file
65
Task/Set/Diego/set.diego
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
use_namespace(rosettacode)_me();
|
||||
|
||||
// Set creation
|
||||
add_set(A)_values(🐖,🦬,🦘,🦫,🦭);
|
||||
add_set(B)_values(🐈⬛,🦬,🦫,🦤,🐐);
|
||||
add_set(C)_values(🐈⬛,🦫);
|
||||
add_set(M)_value(🐖);
|
||||
|
||||
// Membership
|
||||
ms_msg()_calc([M]∈[B])
|
||||
? with_msg()_msg(set M is an element in set B);
|
||||
: with_msg()_msg(set M is not an element in set B);
|
||||
;
|
||||
|
||||
ms_msg()_calc(🐖∈[A])
|
||||
? with_msg()_msg(🐖 is an element in set A);
|
||||
: with_msg()_msg(🐖 is not an element in set A);
|
||||
;
|
||||
|
||||
// Union
|
||||
ms_msg()_msg(A∪B=[])_calc([A]∪[B]);
|
||||
|
||||
// Intersection
|
||||
ms_msg()_msg(A∩B=[])_calc([A]∩[B]);
|
||||
|
||||
// Difference
|
||||
ms_msg()_msg(A∖B=[])_calc([A]∖[B]); // U+2216 is used not U+005c (\)
|
||||
ms_msg()_msg(A\\B=[])_calc([A]\\[B]); // U+005c (\) has to be escaped
|
||||
|
||||
// Subset
|
||||
ms_msg()_calc([C]⊆[A])
|
||||
? with_msg()_msg(set C is a subset of set A);
|
||||
: with_msg()_msg(set C is not a subset of set A);
|
||||
;
|
||||
|
||||
ms_msg()_calc([C]⊆[B])
|
||||
? with_msg()_msg(set C is a subset of set B);
|
||||
: with_msg()_msg(set C is not a subset of set B);
|
||||
;
|
||||
|
||||
// Equality
|
||||
ms_msg()_calc([A]=[B])
|
||||
? with_msg()_msg(set A is equal to set B);
|
||||
: with_msg()_msg(set A is not equal to set B);
|
||||
;
|
||||
|
||||
// Test
|
||||
ms_msg()_calc([A]⊂[B])_or()_calc([A]⊊[B])
|
||||
? with_msg()_msg(set A is a proper subset of set B);
|
||||
: with_msg()_msg(set A is not a proper subset of set B);
|
||||
;
|
||||
|
||||
ms_msg()_calc([C]⊂[B]||[C]⊊[B]) // alternative syntax
|
||||
? with_msg()_msg(set C is a proper subset of set B);
|
||||
: with_msg()_msg(set C is not a proper subset of set B);
|
||||
;
|
||||
|
||||
// Modify a mutable set (all sets are mutable)
|
||||
with_set(M)_push(🦬,🦘,🦫,🦭);
|
||||
ms_msg()_calc([M]=[A])
|
||||
? with_msg()_msg(set M is equal to set A);
|
||||
: with_msg()_msg(set M is not equal to set A);
|
||||
;
|
||||
|
||||
reset_namespace[];
|
||||
Loading…
Add table
Add a link
Reference in a new issue