diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-25 17:05:41 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-25 17:05:41 -0500 |
commit | b359789c4625d197f5c6ea48a4ab45467985f5e9 (patch) | |
tree | 880c9c75a70a698c5ab170140e70c740992d6f5c /std | |
parent | c0cb1699b83331daf960c28d49f46ceb57906170 (diff) |
each => for
Diffstat (limited to 'std')
-rw-r--r-- | std/arr.toc | 6 | ||||
-rw-r--r-- | std/io.toc | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/std/arr.toc b/std/arr.toc index fcf6a45..af89ecb 100644 --- a/std/arr.toc +++ b/std/arr.toc @@ -11,7 +11,7 @@ pkg "arr"; 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; @@ -20,8 +20,8 @@ pkg "arr"; a.len += 1; }; -#export arr_foreach ::= fn(t ::=, a : Arr(t), f : fn(&t)) { - each i := 0..a.len-1 { +#export arr_forfor ::= fn(t ::=, a : Arr(t), f : fn(&t)) { + for i := 0..a.len-1 { f(&a.data[i]); } }; @@ -3,7 +3,7 @@ pkg "io"; c_putchar :: fn(i32) i32 = #foreign "putchar", "libc.so.6"; #export puts ::= fn(x: []char) { - each c := x { + for c := x { c_putchar(c as i32); }; c_putchar('\n' as i32); |