Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -24,6 +24,6 @@ public program()
{
for(int i := 0; i <= 10; i+=1)
{
console.printLine(fibu(i))
Console.printLine(fibu(i))
}
}

View file

@ -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()
}