Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,15 +0,0 @@
|
|||
static function fib(steps:Int, handler:Int->Void)
|
||||
{
|
||||
var current = 0;
|
||||
var next = 1;
|
||||
|
||||
for (i in 1...steps)
|
||||
{
|
||||
handler(current);
|
||||
|
||||
var temp = current + next;
|
||||
current = next;
|
||||
next = temp;
|
||||
}
|
||||
handler(current);
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
class FibIter
|
||||
{
|
||||
private var current = 0;
|
||||
private var nextItem = 1;
|
||||
private var limit:Int;
|
||||
|
||||
public function new(limit) this.limit = limit;
|
||||
|
||||
public function hasNext() return limit > 0;
|
||||
|
||||
public function next() {
|
||||
limit--;
|
||||
var ret = current;
|
||||
var temp = current + nextItem;
|
||||
current = nextItem;
|
||||
nextItem = temp;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
for (i in new FibIter(10))
|
||||
Sys.println(i);
|
||||
Loading…
Add table
Add a link
Reference in a new issue