Compare commits

..

7 commits

Author SHA1 Message Date
c5a843ea39
intellij settings
All checks were successful
/ test (push) Successful in 49s
2026-08-20 13:54:37 +02:00
72b2ec224b
add composite simplifaction 2026-08-20 13:54:37 +02:00
aeb305210c
new go.work.sum 2026-08-20 13:54:36 +02:00
0f905a7fea
Add set index in list, and update lib+examples+tests 2026-08-20 13:54:36 +02:00
8d12c0bdf8 fix missing string-conversions
All checks were successful
/ test (push) Successful in 49s
2026-08-17 17:15:34 +02:00
42fa039daf basic records support
All checks were successful
/ test (push) Successful in 50s
2026-08-17 17:08:24 +02:00
db3a3e29eb
add basic records
All checks were successful
/ test (push) Successful in 51s
2026-07-15 21:48:30 +02:00
19 changed files with 0 additions and 287 deletions

View file

@ -1,40 +0,0 @@
import "lib/math.ang"
primes := [2]
func is_prime(x: number) boolean {
i := 0
while i < primes.length() && primes.at(i)*primes.at(i) < x {
if mod(x, primes.at(i)) == 0 {
return false
}
i = i + 1
}
return true
}
n := 1
max := 100000
while n < max {
n = n + 2
if is_prime(n) {
primes.append(n)
# Update counter
print(char(0x0D))
print(str(n))
print("/")
print(str(max))
print(char(0x09))
print(str(roundd(n/max*100, 2)))
print("%")
print(char(0x09))
print(str(primes.length()))
print(" primes")
}
}
write(str(primes))

View file

@ -1,20 +0,0 @@
fn fib(n: int) -> int {
if n < 2 {
n
} else {
fib(n-1) + fib(n-2)
}
}
println(fib(2))
fn other(n: int) -> int {
if n <= 0 {
n
} else {
println(n)
(n - 1)
}
}
println(other(2))

View file

@ -1,15 +0,0 @@
MAX_WIDTH := 16
print(" ")
w := 1
n := 0x21
while n < 0xA0 {
print(char(n))
n = n + 1
w = w + 1
if w >= MAX_WIDTH {
write("")
w = 0
}
}

View file

@ -1,24 +0,0 @@
passphrase := "Hello world!".split("")
start := [0, 0, 0]
modulus := 10
base := byte("!")
i := 0
n := 0
while n < passphrase.length() {
b := byte(passphrase.at(n))
v = start.at(i) + b - base
while v >= modulus {
v = v - modulus
}
start.put(i, v)
if i >= 3 {
i = 0
}
n = n + 1
}

View file

@ -1,2 +0,0 @@
write(char(0x12) + char(0x85) + char(0x07))

View file

@ -1,11 +0,0 @@
fn counter() -> (fn() -> int) {
i := 0
fn() -> int { i = i + 1 }
}
next := counter()
println(next())
println(next())
println(next())

View file

@ -1,4 +0,0 @@
import "lib/honning.ang"
write(_bell+_italic+"Hello "+_underline+"world "+_strike+"micheal"+_reset)

View file

@ -1,8 +0,0 @@
fn foo(n: int) -> str {
if n % 2 == 0 {
"foo"
} else {
"bar"
}
}

View file

@ -1,15 +0,0 @@
func is_cool(x: number|string) boolean {
if x == "cool" {
return true
} else if x == 69 {
return true
}
return nil
}
write(str(is_cool("not cool")))
write(str(is_cool("cool")))
write(str(is_cool(0)))
write(str(is_cool(69)))

View file

@ -1,2 +0,0 @@
foo := include "foo.ang"

View file

@ -1,4 +0,0 @@
a := fn b(n: int) -> int {
n + 1
}

View file

@ -1,8 +0,0 @@
func get(url: string) string {
res := request("GET", url, "")
return res.text
}
write(get("https://www.neemek.com/hello.txt"))

View file

@ -1,18 +0,0 @@
import "../lib/math.ang"
# Inputs
c := 1.0*pow(10.0, -2.0)
println(c)
pH := -log(c, 10.0)
println(pH)
if pH == 7.0 {
println("pH-en er nøytral (=7)")
} else if pH < 7.0 {
println("pH-en er sur (<7)")
} else {
println("pH-en er basisk (>7)")
}

View file

@ -1,21 +0,0 @@
type Vec2 = (float, float)
fn add(a: Vec2, b: Vec2) -> Vec2 {
(a[0] + b[0], a[1] + b[1])
}
fn sub(a: Vec2, b: Vec2) -> Vec2 {
(a[0] - b[0], a[1] - b[1])
}
fn dot(a: Vec2, b: Vec2) -> float {
a[0]*b[0] + a[1]*b[1]
}
u := (0.0, 1.0)
v := (2.0, 3.0)
println(add(u, v))
println(sub(u, v))
println(dot(u, v))

View file

@ -1,6 +0,0 @@
#!/Users/neemek/Code/anglais/cli/cli run
import "lib/math.ang"
x := sqrt(9485739448)
write(str(x))

View file

@ -1,8 +0,0 @@
a := 0
while a < 10 {
print(".")
a = a + 1
}
write("")

View file

@ -1,25 +0,0 @@
# Aliases
type Receiver = fn() -> any
type Sender = fn(any)
fn new_channel() -> (Sender, Receiver) {
queue := []
fn send(n: any) {
queue.push(n) # mutate in-place
}
fn recv() -> any | nil {
queue.pop()
}
(send, recv)
}
(send, recv) := new_channel()
(
send:,
recv:,
)

View file

@ -1,4 +0,0 @@
import "worst.ang"
write("Hello world!")

View file

@ -1,52 +0,0 @@
fn range(from: int, to: int) -> (fn() -> (int, bool)) {
i := from - 1
fn() -> (int, bool) {
i = i + 1
if i >= to {
(-1, false)
} else {
(i, true)
}
}
}
for i in range(0, 10) {
println(i)
}
fn chars(s: str) -> (fn() -> (str, bool)) {
i := 0
fn() -> (str, bool) {
if i >= s.length() {
("", false)
} else {
c := s[i]
i = i + 1
(c, true)
}
}
}
for c in chars("hello") {
print(c)
print(" ")
}
println("")
fn items(l: [any]) -> (fn() -> (any, bool)) {
i := 0
fn() -> (any, bool) {
if i >= l.length() {
(nil, false)
} else {
i = i + 1
(l[i - 1], true)
}
}
}