summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc23
1 files changed, 17 insertions, 6 deletions
diff --git a/test.toc b/test.toc
index d17b226..65f9f30 100644
--- a/test.toc
+++ b/test.toc
@@ -9,15 +9,26 @@ putf @= fn(x: float) {
");
};
-lsh @= fn(x: int, bits: int) int {
- each 1..bits {
- x *= 2;
+sum @= fn(x: []int) int {
+ total := 0;
+ p := &x[0];
+ while p < &x[0] + x.len {
+ total += *p;
+ p += 1;
+ }
+ total
+};
+
+some_sum @= fn() int {
+ foo := new(int, 10);
+ each _, i := foo {
+ foo[i] = i;
}
- x
+ sum(foo)
};
main @= fn() {
- puti(lsh(2, 15));
- X @= lsh(2, 15);
+ puti(some_sum());
+ X @= some_sum();
puti(X);
};