Refresh the repo

This commit is contained in:
Krzosa Karol
2026-03-20 08:35:18 +01:00
parent 771e9b59b3
commit 6e18bb6641
77 changed files with 27788 additions and 27766 deletions

View File

@@ -0,0 +1,26 @@
Vec3 :: struct;; x: F32; y: F32; z: F32
// We can define operator overloads for arbitrary types
// these are just regular lambdas/functions
"+" :: (a: Vec3, b: Vec3): Vec3
return {a.x+b.x, a.y+b.y, a.z+b.z}
// We can make a one liner out of these using ';;' operator
// which functions as a new line with indent
"-" :: (a: Vec3, b: Vec3): Vec3 ;; return {a.x-b.x, a.y-b.y, a.z-b.z}
"-" :: (a: Vec3): Vec3 ;; return {-a.x, -a.y, -a.z}
main :: (): int
a := Vec3{1,1,1}
b := Vec3{2,3,4}
// The expressions are replaced with the defined lambdas
c := a + b
Assert(c.x == 3 && c.y == 4 && c.z == 5)
d := -c
Assert(d.x == -3 && d.y == -4 && d.z == -5)
e := c - d
Assert(e.x == 6 && e.y == 8 && e.z == 10)
return 0