Add set index in list, and update lib+examples+tests
This commit is contained in:
parent
8d12c0bdf8
commit
0f905a7fea
12 changed files with 117 additions and 60 deletions
|
|
@ -1,14 +1,15 @@
|
|||
# This program computes the fibonacci numbers using recursion (O(2^n))
|
||||
# It is very slow
|
||||
func fib(x: number) number {
|
||||
fn fib(x: number) number {
|
||||
if x <= 1 {
|
||||
return x
|
||||
x
|
||||
} else {
|
||||
fib(x - 1) + fib(x - 2)
|
||||
}
|
||||
return fib(x - 1) + fib(x - 2)
|
||||
}
|
||||
|
||||
n := 0
|
||||
while n < 100 {
|
||||
write(str(fib(n)))
|
||||
println(fib(n))
|
||||
n = n + 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue