diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arr3.toc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/arr3.toc b/tests/arr3.toc index cfbbc5a..4310d64 100644 --- a/tests/arr3.toc +++ b/tests/arr3.toc @@ -1,11 +1,6 @@ #include "io.toc"; #include "mem.toc"; -Arr ::= struct (t :: Type) { - data: []t; - len, cap: int; -}; - arr_add ::= fn(t ::=, a : &Arr(t), x : t) { if a.len >= a.cap { @@ -33,14 +28,14 @@ square ::= fn(t ::=, x : t) t { }; -// ArrInt ::= Arr(int); +ArrInt ::= Arr(int); inc ::= fn(t ::=, x : t) t { x + 1 }; main ::= fn() { - arr : Arr(int); + arr : ArrInt; farr : Arr(float); for i := 1..100 { arr_add(&arr, inc(square(i))); @@ -53,3 +48,8 @@ main ::= fn() { puti(farr.data[i] as int); } }; + +Arr ::= struct (t :: Type) { + data: []t; + len, cap: int; +}; |