diff options
author | ubq323 <ubq323@ubq323.website> | 2024-08-03 17:49:54 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-08-03 17:49:54 +0100 |
commit | 1f257ac91ef3813c563203eacb5320b210fc1aa7 (patch) | |
tree | afd68b70c3c5486b7931419f7164c6ddb16023ab | |
parent | aa0485fe33204169724d020f9c5e3b91e558ab1e (diff) |
change array representation
-rw-r--r-- | tests/arr1.out | 4 | ||||
-rw-r--r-- | tests/arr2.out | 2 | ||||
-rw-r--r-- | tests/arr3.out | 2 | ||||
-rw-r--r-- | tests/arr4.out | 2 | ||||
-rw-r--r-- | tests/arr5.out | 2 | ||||
-rw-r--r-- | tests/arr6.out | 4 | ||||
-rw-r--r-- | tests/arr7.out | 4 | ||||
-rw-r--r-- | tests/iota_imp.out | 2 | ||||
-rw-r--r-- | tests/iota_rec.out | 2 | ||||
-rw-r--r-- | tests/map.out | 4 | ||||
-rw-r--r-- | tests/pend.out | 38 | ||||
-rw-r--r-- | tests/pend2.bth | 7 | ||||
-rw-r--r-- | tests/pend2.out | 2 | ||||
-rw-r--r-- | tests/whilelet.out | 2 | ||||
-rw-r--r-- | val.c | 6 |
15 files changed, 46 insertions, 37 deletions
diff --git a/tests/arr1.out b/tests/arr1.out index 3e5e246..4ce34fa 100644 --- a/tests/arr1.out +++ b/tests/arr1.out @@ -1,5 +1,5 @@ -[ ] +[] 0 -[ 10 20 30 ] +[10 20 30] 3 20 diff --git a/tests/arr2.out b/tests/arr2.out index 42a9264..d2b213b 100644 --- a/tests/arr2.out +++ b/tests/arr2.out @@ -1 +1 @@ -[ 1 2 3 4 99 ] +[1 2 3 4 99] diff --git a/tests/arr3.out b/tests/arr3.out index f5d7903..46226f8 100644 --- a/tests/arr3.out +++ b/tests/arr3.out @@ -1 +1 @@ -[ 1 2 3 4 5 ] +[1 2 3 4 5] diff --git a/tests/arr4.out b/tests/arr4.out index c508125..219172b 100644 --- a/tests/arr4.out +++ b/tests/arr4.out @@ -1 +1 @@ -[ 1 2 3 4 5 6 7 8 9 10 ] +[1 2 3 4 5 6 7 8 9 10] diff --git a/tests/arr5.out b/tests/arr5.out index 7704f22..a3d9ba1 100644 --- a/tests/arr5.out +++ b/tests/arr5.out @@ -1 +1 @@ -[ 1 2 3 10 ] +[1 2 3 10] diff --git a/tests/arr6.out b/tests/arr6.out index e80d1c2..0cdaaf5 100644 --- a/tests/arr6.out +++ b/tests/arr6.out @@ -1,2 +1,2 @@ -[ 10 20 30 ] -[ 10 50 30 ] +[10 20 30] +[10 50 30] diff --git a/tests/arr7.out b/tests/arr7.out index 7d6d4b2..69e801e 100644 --- a/tests/arr7.out +++ b/tests/arr7.out @@ -1,2 +1,2 @@ -[ 10 20 30 ] -[ 10 20 30 40 ] +[10 20 30] +[10 20 30 40] diff --git a/tests/iota_imp.out b/tests/iota_imp.out index 0f6e04d..ba28818 100644 --- a/tests/iota_imp.out +++ b/tests/iota_imp.out @@ -1 +1 @@ -[ 0 1 2 3 4 5 6 7 8 9 ] +[0 1 2 3 4 5 6 7 8 9] diff --git a/tests/iota_rec.out b/tests/iota_rec.out index 0f6e04d..ba28818 100644 --- a/tests/iota_rec.out +++ b/tests/iota_rec.out @@ -1 +1 @@ -[ 0 1 2 3 4 5 6 7 8 9 ] +[0 1 2 3 4 5 6 7 8 9] diff --git a/tests/map.out b/tests/map.out index 41f7fac..08f183e 100644 --- a/tests/map.out +++ b/tests/map.out @@ -1,2 +1,2 @@ -[ 10 20 30 40 50 60 70 80 90 ] -[ 1 4 9 16 25 36 49 64 81 ] +[10 20 30 40 50 60 70 80 90] +[1 4 9 16 25 36 49 64 81] diff --git a/tests/pend.out b/tests/pend.out index 44239f7..8d5f9c0 100644 --- a/tests/pend.out +++ b/tests/pend.out @@ -1,19 +1,19 @@ -[ 10 ] -[ 100 200 ] -[ 22 33 ] -[ 11 111 222 ] -[ 333 444 99 ] -[ 555 666 777 888 ] -[ 10 11 12 ] -[ 10 11 20 30 ] -[ 10 222 333 99 ] -[ 10 22 33 44 55 ] -[ 100 200 33 44 ] -[ 100 200 33 444 555 ] -[ 100 200 33 44 55 ] -[ 100 200 333 444 555 666 ] -[ ] -[ 1 ] -[ 10 ] -[ 20 ] -[ ] +[10] +[100 200] +[22 33] +[11 111 222] +[333 444 99] +[555 666 777 888] +[10 11 12] +[10 11 20 30] +[10 222 333 99] +[10 22 33 44 55] +[100 200 33 44] +[100 200 33 444 555] +[100 200 33 44 55] +[100 200 333 444 555 666] +[] +[1] +[10] +[20] +[] diff --git a/tests/pend2.bth b/tests/pend2.bth new file mode 100644 index 0000000..69004df --- /dev/null +++ b/tests/pend2.bth @@ -0,0 +1,7 @@ +(defn (f x) + (, 10 + (if x 5 [6 7 8]) + 100)) + +(say (f true)) +(say (f false)) diff --git a/tests/pend2.out b/tests/pend2.out new file mode 100644 index 0000000..c7475a5 --- /dev/null +++ b/tests/pend2.out @@ -0,0 +1,2 @@ +[10 5 100] +[10 6 7 8 100] diff --git a/tests/whilelet.out b/tests/whilelet.out index 013e367..260d17f 100644 --- a/tests/whilelet.out +++ b/tests/whilelet.out @@ -1,2 +1,2 @@ 200 -[ 0 1 2 3 4 5 6 7 8 9 ] +[0 1 2 3 4 5 6 7 8 9] @@ -113,10 +113,10 @@ static void print_val_h(Val v, int depth) { if (depth <= 0) printf("<arr>"); else { - printf("[ "); - for (int i = 0; i < a->len; i++) { + printf("["); + for (int i = 0; i < a->len ; i++) { print_val_h(a->d[i], depth-1); - printf(" "); + if (i < a->len - 1) printf(" "); } printf("]"); } |