add inner (of lists) type, add floor, ceil, and roundd standard functions, and a ton of examples
This commit is contained in:
parent
5bcab07681
commit
efbe5a9f97
20 changed files with 330 additions and 46 deletions
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
# fibonacci sequence
|
||||
func fib(n) {
|
||||
if n <= 1 {
|
||||
return n
|
||||
}
|
||||
|
||||
return fib(n - 1) + fib(n - 2)
|
||||
# This program computes the fibonacci numbers using recursion (O(2^n))
|
||||
# It is very slow
|
||||
func fib(x: number) number {
|
||||
if x <= 1 {
|
||||
return x
|
||||
}
|
||||
return fib(x - 1) + fib(x - 2)
|
||||
}
|
||||
|
||||
n := 0
|
||||
while n < 10 {
|
||||
write(fib(n))
|
||||
n = n + 1
|
||||
while n < 100 {
|
||||
write(str(fib(n)))
|
||||
n = n + 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue