Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/Generator-Exponential/Tcl/generator-exponential.tcl
Normal file
31
Task/Generator-Exponential/Tcl/generator-exponential.tcl
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package require Tcl 8.6
|
||||
|
||||
proc powers m {
|
||||
yield
|
||||
for {set n 0} true {incr n} {
|
||||
yield [expr {$n ** $m}]
|
||||
}
|
||||
}
|
||||
coroutine squares powers 2
|
||||
coroutine cubes powers 3
|
||||
coroutine filtered apply {{s1 s2} {
|
||||
yield
|
||||
set f [$s2]
|
||||
set v [$s1]
|
||||
while true {
|
||||
if {$v > $f} {
|
||||
set f [$s2]
|
||||
continue
|
||||
} elseif {$v < $f} {
|
||||
yield $v
|
||||
}
|
||||
set v [$s1]
|
||||
}
|
||||
}} squares cubes
|
||||
|
||||
# Drop 20
|
||||
for {set i 0} {$i<20} {incr i} {filtered}
|
||||
# Take/print 10
|
||||
for {} {$i<30} {incr i} {
|
||||
puts [filtered]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue