diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-03 18:12:55 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-03 18:12:55 -0500 |
commit | 9178cac428c188acc096984e704d5707bdab0a35 (patch) | |
tree | 7127671f7ce61041625881a540a550217fe26c51 /tests | |
parent | abbd3d0e252d3694edb151ad2b5010cc2c5c4736 (diff) |
fixing const param bug
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc.toc | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/tests/misc.toc b/tests/misc.toc index d66972f..a9f6dc1 100644 --- a/tests/misc.toc +++ b/tests/misc.toc @@ -1,27 +1,29 @@ #include "io.toc", io; -arr_sum ::= fn(n::=, t::=, a:[n]t) t { - total := 0 as t; - for x := a { - total += x; +main ::= fn() { + x ::= 3; + #if x > 2 { + io.puts("Hello!"); + } else { + foo("yes"); } - total -}; -mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { - a[0] = x; - a[1] = y; - a[2] = z; -}; + io.puti(arr_sum(mk_arr(5,89,22))); + io.puti(arr_sum(mk_arr(1,2,3))); + io.puti(arr_sum(mk_arr(z=0, 0, 0))); + + arr_sum ::= fn(n::=, t::=, a:[n]t) t { + total := 0 as t; + for x := a { + total += x; + } + total + }; -main ::= fn() { - x ::= 3; - #if x > 2 { - io.puts("Hello!"); - } else { - foo("yes"); - } - io.puti(arr_sum(mk_arr(5,89,22))); - io.puti(arr_sum(mk_arr(1,2,3))); - io.puti(arr_sum(mk_arr(z=0, 0, 0))); -};
\ No newline at end of file + mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { + a[0] = x; + a[1] = y; + a[2] = z; + }; + +}; |