From b359789c4625d197f5c6ea48a4ab45467985f5e9 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sat, 25 Jan 2020 17:05:41 -0500 Subject: each => for --- std/arr.toc | 6 +++--- std/io.toc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'std') 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]); } }; diff --git a/std/io.toc b/std/io.toc index 7507baf..ab3549b 100644 --- a/std/io.toc +++ b/std/io.toc @@ -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); -- cgit v1.2.3