Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -24,6 +24,6 @@ public program()
|
|||
{
|
||||
for(int i := 0; i <= 10; i+=1)
|
||||
{
|
||||
console.printLine(fibu(i))
|
||||
Console.printLine(fibu(i))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,40 @@
|
|||
import extensions;
|
||||
|
||||
public FibonacciGenerator
|
||||
singleton FibonacciEnumerable : Enumerable
|
||||
{
|
||||
yieldable next()
|
||||
{
|
||||
Enumerator enumerator()
|
||||
= FibonacciEnumerable.infinitEnumerator();
|
||||
|
||||
yield Enumerator infinitEnumerator()
|
||||
{
|
||||
long n_2 := 1l;
|
||||
long n_1 := 1l;
|
||||
|
||||
$yield n_2;
|
||||
$yield n_1;
|
||||
:yield n_2;
|
||||
:yield n_1;
|
||||
|
||||
while(true)
|
||||
{
|
||||
long n := n_2 + n_1;
|
||||
|
||||
$yield n;
|
||||
:yield n;
|
||||
|
||||
n_2 := n_1;
|
||||
n_1 := n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public program()
|
||||
{
|
||||
auto e := new FibonacciGenerator();
|
||||
auto e := FibonacciEnumerable.enumerator();
|
||||
|
||||
for(int i := 0; i < 10; i += 1) {
|
||||
console.printLine(e.next())
|
||||
if(!e.next())
|
||||
InvalidOperationException.raise();
|
||||
|
||||
for(int i := 0; i < 10 && e.next(); i += 1) {
|
||||
Console.printLine(*e)
|
||||
};
|
||||
|
||||
console.readChar()
|
||||
Console.readChar()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue