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
28
Task/Generator-Exponential/Sidef/generator-exponential.sidef
Normal file
28
Task/Generator-Exponential/Sidef/generator-exponential.sidef
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
func gen_pow(m) {
|
||||
var e = 0;
|
||||
func { e++ ** m };
|
||||
}
|
||||
|
||||
func gen_filter(g1, g2) {
|
||||
var v2 = g2.run;
|
||||
func {
|
||||
loop {
|
||||
var v1 = g1.run;
|
||||
while (v1 > v2) { v2 = g2.run };
|
||||
v1 == v2 || return v1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Create generators.
|
||||
var squares = gen_pow(2);
|
||||
var cubes = gen_pow(3);
|
||||
var squares_without_cubes = gen_filter(squares, cubes);
|
||||
|
||||
# Drop 20 values.
|
||||
20.times { squares_without_cubes() };
|
||||
|
||||
# Print 10 values.
|
||||
var answer = [];
|
||||
10.times { answer.append(squares_without_cubes()) };
|
||||
say answer;
|
||||
Loading…
Add table
Add a link
Reference in a new issue