1use <prelude.kav>
2use <os.kav> as os
3use <buffer.kav> as buf
4use <list.kav> as list
5
6fn argz[n: nat](out: buf::Buffer, args: list::List[cstr, n]) -> buf::Buffer {
7 case args of {
8 | ~list::Cons(arg, list::Nil) => buf::puts(out, arg)
9 | ~list::Cons(arg, rest) => {
10 buf::puts(out, arg)
11 |> buf::putc(' ')
12 |> argz(rest)
13 }
14 }
15}
16
17fn main(w: World) -> World {
18 val _ = case os::args(w) of {
19 | ~list::Nil => buf::stdout(w) |> buf::close()
20 | ~list::Cons(_, rest) =>
21 buf::stdout(w)
22 |> argz(rest)
23 |> buf::putc('\n')
24 |> buf::close()
25 }
26 w
27}