diff options
Diffstat (limited to 'tests/arr2')
-rw-r--r-- | tests/arr2/arr2.toc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/arr2/arr2.toc b/tests/arr2/arr2.toc index 7056416..e28d355 100644 --- a/tests/arr2/arr2.toc +++ b/tests/arr2/arr2.toc @@ -21,7 +21,7 @@ arr_add ::= fn(t ::=, a : &Arr(t), x : t) { if a.len >= a.cap { a.cap = a.cap * 2 + 2; new_data := new(t, a.cap); - each i := 0..a.len-1 { + for i := 0..a.len-1 { new_data[i] = a.data[i]; } a.data = new_data; @@ -32,11 +32,11 @@ arr_add ::= fn(t ::=, a : &Arr(t), x : t) { square ::= fn(t ::=, x : t) t { a : Arr(t); - each i := 1,2..2*x-1 { + for i := 1,2..2*x-1 { arr_add(&a, i); }; sum := 0 as t; - each i := 0..a.len-1 { + for i := 0..a.len-1 { sum += a.data[i]; }; sum @@ -52,14 +52,14 @@ inc ::= fn(t ::=, x : t) t { main ::= fn() { arr : Arr(int); farr : Arr(float); - each i := 1..100 { + for i := 1..100 { arr_add(&arr, inc(square(i))); arr_add(&farr, inc(square(i as float))); } - each i := 0..arr.len - 1 { + for i := 0..arr.len - 1 { puti(arr.data[i]); } - each i := 0..farr.len - 1 { + for i := 0..farr.len - 1 { putf(farr.data[i]); } }; |