summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-25 17:05:41 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-25 17:05:41 -0500
commitb359789c4625d197f5c6ea48a4ab45467985f5e9 (patch)
tree880c9c75a70a698c5ab170140e70c740992d6f5c /tests
parentc0cb1699b83331daf960c28d49f46ceb57906170 (diff)
each => for
Diffstat (limited to 'tests')
-rw-r--r--tests/arr/arr.toc12
-rw-r--r--tests/arr2/arr2.toc12
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/arr/arr.toc b/tests/arr/arr.toc
index d18e8ea..f7c6707 100644
--- a/tests/arr/arr.toc
+++ b/tests/arr/arr.toc
@@ -19,7 +19,7 @@ arr_add ::= fn(t :: Type, a : &Arr(t), x : t) {
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;
@@ -30,11 +30,11 @@ arr_add ::= fn(t :: Type, a : &Arr(t), x : t) {
square ::= fn(t :: Type, x : t) t {
a : Arr(t);
- each i := 1,2..2*x-1 {
+ for i := 1,2..2*x-1 {
arr_add(t, &a, i);
};
sum := 0 as t;
- each i := 0..a.len-1 {
+ for i := 0..a.len-1 {
sum += a.data[i];
};
sum
@@ -50,14 +50,14 @@ inc ::= fn(t :: Type, x : t) t {
main ::= fn() {
arr : ArrInt;
farr : Arr(float);
- each i := 1..100 {
+ for i := 1..100 {
arr_add(int, &arr, inc(int, square(int, i)));
arr_add(float, &farr, inc(float, square(float, i as float)));
}
- each i := 0..arr.len - 1 {
+ for i := 0..arr.len - 1 {
puti(arr.data[i]);
}
- each i := 0..farr.len - 1 {
+ for i := 0..farr.len - 1 {
putf(farr.data[i]);
}
};
diff --git a/tests/arr2/arr2.toc b/tests/arr2/arr2.toc
index 7056416..e28d355 100644
--- a/tests/arr2/arr2.toc
+++ b/tests/arr2/arr2.toc
@@ -21,7 +21,7 @@ arr_add ::= fn(t ::=, a : &Arr(t), x : t) {
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;
@@ -32,11 +32,11 @@ arr_add ::= fn(t ::=, a : &Arr(t), x : t) {
square ::= fn(t ::=, x : t) t {
a : Arr(t);
- each i := 1,2..2*x-1 {
+ for i := 1,2..2*x-1 {
arr_add(&a, i);
};
sum := 0 as t;
- each i := 0..a.len-1 {
+ for i := 0..a.len-1 {
sum += a.data[i];
};
sum
@@ -52,14 +52,14 @@ inc ::= fn(t ::=, x : t) t {
main ::= fn() {
arr : Arr(int);
farr : Arr(float);
- each i := 1..100 {
+ for i := 1..100 {
arr_add(&arr, inc(square(i)));
arr_add(&farr, inc(square(i as float)));
}
- each i := 0..arr.len - 1 {
+ for i := 0..arr.len - 1 {
puti(arr.data[i]);
}
- each i := 0..farr.len - 1 {
+ for i := 0..farr.len - 1 {
putf(farr.data[i]);
}
};