From 4cf1e1fa0e11307005a724225ea3ae2f80a5c037 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 30 Jun 2024 21:37:14 +0100 Subject: add array index setting syntax --- tests/arr6.bth | 4 ++++ tests/arr6.out | 2 ++ tests/arr7.bth | 4 ++++ tests/arr7.out | 2 ++ tests/arr8.bth | 3 +++ tests/arr8.out | 1 + tests/sumrec.bth | 2 +- tests/sumrec.out | 2 +- 8 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/arr6.bth create mode 100644 tests/arr6.out create mode 100644 tests/arr7.bth create mode 100644 tests/arr7.out create mode 100644 tests/arr8.bth create mode 100644 tests/arr8.out (limited to 'tests') diff --git a/tests/arr6.bth b/tests/arr6.bth new file mode 100644 index 0000000..e814db4 --- /dev/null +++ b/tests/arr6.bth @@ -0,0 +1,4 @@ +(let (a [10 20 30]) + (say a) + (set (a 1) 50) + (say a)) diff --git a/tests/arr6.out b/tests/arr6.out new file mode 100644 index 0000000..e80d1c2 --- /dev/null +++ b/tests/arr6.out @@ -0,0 +1,2 @@ +[ 10 20 30 ] +[ 10 50 30 ] diff --git a/tests/arr7.bth b/tests/arr7.bth new file mode 100644 index 0000000..7b9a784 --- /dev/null +++ b/tests/arr7.bth @@ -0,0 +1,4 @@ +(let (a [10 20 30]) + (say a) + (set (a 3) 40) + (say a)) diff --git a/tests/arr7.out b/tests/arr7.out new file mode 100644 index 0000000..7d6d4b2 --- /dev/null +++ b/tests/arr7.out @@ -0,0 +1,2 @@ +[ 10 20 30 ] +[ 10 20 30 40 ] diff --git a/tests/arr8.bth b/tests/arr8.bth new file mode 100644 index 0000000..8f41f0c --- /dev/null +++ b/tests/arr8.bth @@ -0,0 +1,3 @@ +(let (a [10 20 30]) + (set (a 1) 50) + (let (x 100 y 200 z 300) (say y))) diff --git a/tests/arr8.out b/tests/arr8.out new file mode 100644 index 0000000..08839f6 --- /dev/null +++ b/tests/arr8.out @@ -0,0 +1 @@ +200 diff --git a/tests/sumrec.bth b/tests/sumrec.bth index 8c8804a..0bbf2b6 100644 --- a/tests/sumrec.bth +++ b/tests/sumrec.bth @@ -4,4 +4,4 @@ (f' (- x 1) (+ acc x))))) (set f (fn (x) (f' x 0))) (say (f 10)) -(say (f 100)) +(say (f 1000)) diff --git a/tests/sumrec.out b/tests/sumrec.out index e613215..2a5dbfe 100644 --- a/tests/sumrec.out +++ b/tests/sumrec.out @@ -1,2 +1,2 @@ 55 -5050 +500500 -- cgit v1.2.3