commit b57370c7e257f6f5c2988a8aca2f6836c6a5552f
parent 6998426c94d9dadcc3ec17cdc13302a62688b5e2
Author: citbl <citbl@citbl.org>
Date: Thu, 21 May 2026 20:45:43 +1000
monkey business
Diffstat:
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/language2.mty b/language2.mty
@@ -3,7 +3,8 @@ ns app
use io
use math
-struct Vec2 ::
+struct
+Vec2 ::
float x
float y
@@ -16,7 +17,8 @@ struct Vec2 ::
=
min(max(x, lo), hi)
-struct Reading ::
+pub struct
+Reading ::
int sensor
float value
bool valid
@@ -28,15 +30,18 @@ struct Reading ::
"high" if .value > 100.0 else "normal"
pre #xs > 0
-float mean(float[] xs) = +/xs / #xs
+pub float
+mean(float[] xs) = +/xs / #xs
-float[] values(Reading[] rows) =
+pub float[]
+values(Reading[] rows) =
rows[.usable()]
| @(.value)
-int main() ::
+int
+main() ::
Reading[] rows = load_readings("readings.csv")
float[] xs = values(rows)
diff --git a/mtc/target.mty b/mtc/target.mty
@@ -1,6 +1,9 @@
-int add(int a, int b) =
+int
+add(int a, int b) =
a + b
-int main() ::
+
+int
+main() ::
ret add(1, 2)
// target QBE:
diff --git a/mtcc/target.mty b/mtcc/target.mty
@@ -1,7 +1,8 @@
-int add(int a, int b) =
- a + b
-int main() ::
- ret add(1, 2)
+pub
+add(int a, int b) : int = a + b
+
+main() : int =
+ add(1, 2)
// target QBE:
@@ -10,3 +11,7 @@ int main() ::
// %r =w add %a, %b
// ret %r
//}
+
+
+
+