add inner (of lists) type, add floor, ceil, and roundd standard functions, and a ton of examples

This commit is contained in:
Neemek 2025-07-22 22:24:12 +02:00
parent 5bcab07681
commit efbe5a9f97
Signed by: neemek
GPG key ID: 28360A8951CD0E9B
20 changed files with 330 additions and 46 deletions

0
examples/brainfuck.ang Normal file
View file

View file

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

13
examples/solving.ang Normal file
View file

@ -0,0 +1,13 @@
import "../lib/math.ang"
a := 120
b := 10
# find log_b(a)
func f(x: number)number {
return pow(b, x) - a
}
log_b := newtons(f)
write(str(log_b))
write("inverse: "+str(pow(b, log_b))+" = "+str(a))