Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
25
Task/Set-consolidation/Sidef/set-consolidation.sidef
Normal file
25
Task/Set-consolidation/Sidef/set-consolidation.sidef
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
func consolidate() { [] }
|
||||
func consolidate(this, *those) {
|
||||
gather {
|
||||
consolidate(those...).each { |that|
|
||||
if (this & that) { this |= that }
|
||||
else { take that }
|
||||
}
|
||||
take this;
|
||||
}
|
||||
}
|
||||
|
||||
enum |A="A", B, C, D, _E, F, G, H, I, _J, K|;
|
||||
|
||||
func format(ss) {
|
||||
ss.map{ '(' + .join(' ') + ')' }.join(' ')
|
||||
}
|
||||
|
||||
[
|
||||
[[A,B], [C,D]],
|
||||
[[A,B], [B,D]],
|
||||
[[A,B], [C,D], [D,B]],
|
||||
[[H,I,K], [A,B], [C,D], [D,B], [F,G,H]]
|
||||
].each { |ss|
|
||||
say (format(ss), "\n\t==> ", format(consolidate(ss...)));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue