diff options
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 33 |
1 files changed, 3 insertions, 30 deletions
@@ -1,37 +1,10 @@ printf ::= #foreign("printf","libc.so.6") fn(#C &"const char", #C ..) #C int; -tprintf ::= fn(fmt: []char, args: ..) { - printf(&fmt[0], args); -}; - -sum ::= fn(x: ..) int { - total := 0; - n := 0; - for a, i := x { - total += a + i - i + 1; - n += 1; - } - total - n -}; - -sumc ::= fn(x:: ..) int { - total := 0; - n := 0; - for a, i := x { - total += a + i - i + 1; - n += 1; - } - total - n -}; -do_printing ::= fn(x::..) { - tprintf("%ld\n",sum(x)); - tprintf("%ld\n",sumc(x)); +f ::= fn(x: int, y: int) int { + x+y }; main ::= fn() { - do_printing(); - do_printing(1,2,3); - do_printing(4); - do_printing(1,10,100,1000,10000); + f(3,4 as typeof f(3,4)); }; |