diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arr1.bth | 2 | ||||
-rw-r--r-- | tests/arr5.bth | 2 | ||||
-rw-r--r-- | tests/arr6.bth | 2 | ||||
-rw-r--r-- | tests/arr7.bth | 2 | ||||
-rw-r--r-- | tests/arr8.bth | 2 | ||||
-rw-r--r-- | tests/clos3.bth | 2 | ||||
-rw-r--r-- | tests/clos4.bth | 2 | ||||
-rw-r--r-- | tests/fizzbuzz.bth | 4 | ||||
-rw-r--r-- | tests/flet.bth | 4 | ||||
-rw-r--r-- | tests/func1.bth | 2 | ||||
-rw-r--r-- | tests/func2.bth | 4 | ||||
-rw-r--r-- | tests/func3.bth | 4 | ||||
-rw-r--r-- | tests/func4.bth | 6 | ||||
-rw-r--r-- | tests/func5.bth | 2 | ||||
-rw-r--r-- | tests/mandel.bth | 30 | ||||
-rw-r--r-- | tests/mandel_local.bth | 16 | ||||
-rw-r--r-- | tests/map.bth | 6 | ||||
-rw-r--r-- | tests/sumrec.bth | 4 | ||||
-rw-r--r-- | tests/sumrec_local.bth | 2 | ||||
-rw-r--r-- | tests/vars.bth | 8 | ||||
-rw-r--r-- | tests/vars3.bth | 4 | ||||
-rw-r--r-- | tests/vars4.bth | 4 | ||||
-rw-r--r-- | tests/whilelet.bth | 2 |
23 files changed, 58 insertions, 58 deletions
diff --git a/tests/arr1.bth b/tests/arr1.bth index 0d06759..1120549 100644 --- a/tests/arr1.bth +++ b/tests/arr1.bth @@ -1,4 +1,4 @@ -(set A (arr)) +(set! A (arr)) (say A) (say (len A)) (append A 10) diff --git a/tests/arr5.bth b/tests/arr5.bth index 79d5a7d..15c85e5 100644 --- a/tests/arr5.bth +++ b/tests/arr5.bth @@ -1,3 +1,3 @@ -(set A [1 2 3]) +(set! A [1 2 3]) (let (B A) (append B 10)) (say A) diff --git a/tests/arr6.bth b/tests/arr6.bth index e814db4..063c3dc 100644 --- a/tests/arr6.bth +++ b/tests/arr6.bth @@ -1,4 +1,4 @@ (let (a [10 20 30]) (say a) - (set (a 1) 50) + (set! (a 1) 50) (say a)) diff --git a/tests/arr7.bth b/tests/arr7.bth index 7b9a784..1b40152 100644 --- a/tests/arr7.bth +++ b/tests/arr7.bth @@ -1,4 +1,4 @@ (let (a [10 20 30]) (say a) - (set (a 3) 40) + (set! (a 3) 40) (say a)) diff --git a/tests/arr8.bth b/tests/arr8.bth index 8f41f0c..8ee57b5 100644 --- a/tests/arr8.bth +++ b/tests/arr8.bth @@ -1,3 +1,3 @@ (let (a [10 20 30]) - (set (a 1) 50) + (set! (a 1) 50) (let (x 100 y 200 z 300) (say y))) diff --git a/tests/clos3.bth b/tests/clos3.bth index 4742391..788307b 100644 --- a/tests/clos3.bth +++ b/tests/clos3.bth @@ -1,7 +1,7 @@ (defn (counter) (let (a 0) (fn () - (set a (+ a 1)) + (set! a (+ a 1)) (say a)))) (def c1 (counter)) (def c2 (counter)) diff --git a/tests/clos4.bth b/tests/clos4.bth index c9a2092..0c6fb3a 100644 --- a/tests/clos4.bth +++ b/tests/clos4.bth @@ -1,6 +1,6 @@ (defn (f) (let (a 0) - (defn (s x) (set a x)) + (defn (s x) (set! a x)) (defn (g) a) [s g])) diff --git a/tests/fizzbuzz.bth b/tests/fizzbuzz.bth index 2837b55..a94e4e1 100644 --- a/tests/fizzbuzz.bth +++ b/tests/fizzbuzz.bth @@ -1,9 +1,9 @@ -(set n 1) +(set! n 1) (while (< n 30) (say (if (= 0 (% n 5)) (if (= 0 (% n 3)) "fizzbuzz" "buzz") (if (= 0 (% n 3)) "fizz" n))) - (set n (+ n 1))) + (set! n (+ n 1))) diff --git a/tests/flet.bth b/tests/flet.bth index 102fc34..b4f955c 100644 --- a/tests/flet.bth +++ b/tests/flet.bth @@ -1,5 +1,5 @@ -(set f1 (fn (a b c) (say (* a (+ b c))))) -(set f2 (fn (a) (say (* a a)))) +(set! f1 (fn (a b c) (say (* a (+ b c))))) +(set! f2 (fn (a) (say (* a a)))) (if true (f1 6 2 4) (f2 7)) diff --git a/tests/func1.bth b/tests/func1.bth index a71d160..35c672b 100644 --- a/tests/func1.bth +++ b/tests/func1.bth @@ -1,2 +1,2 @@ -(set f (fn (_) 42)) +(set! f (fn (_) 42)) (say (f 0)) diff --git a/tests/func2.bth b/tests/func2.bth index e57bc27..b47f1fa 100644 --- a/tests/func2.bth +++ b/tests/func2.bth @@ -1,5 +1,5 @@ -(set f1 (fn (a) (* a a))) -(set f2 (fn (a b) (+ a b))) +(set! f1 (fn (a) (* a a))) +(set! f2 (fn (a b) (+ a b))) (say (f1 6)) (say (f2 20 40)) (say (f1 (f2 2 1))) diff --git a/tests/func3.bth b/tests/func3.bth index 9c0ceeb..68d5b20 100644 --- a/tests/func3.bth +++ b/tests/func3.bth @@ -1,5 +1,5 @@ -(set f1 (fn (a b) (* a b))) -(set f2 (fn (x) +(set! f1 (fn (a b) (* a b))) +(set! f2 (fn (x) (let (a 3 g (fn (y) (+ y 7))) (* (g a) (g x))))) diff --git a/tests/func4.bth b/tests/func4.bth index efd2b71..f527ef9 100644 --- a/tests/func4.bth +++ b/tests/func4.bth @@ -1,5 +1,5 @@ -(set f1 (fn (x) (+ x 10))) -(set f2 (fn (x) (* x 10))) -(set g (fn (f x) (say (f x)) (say (f x)))) +(set! f1 (fn (x) (+ x 10))) +(set! f2 (fn (x) (* x 10))) +(set! g (fn (f x) (say (f x)) (say (f x)))) (g f1 26) (g f2 6) diff --git a/tests/func5.bth b/tests/func5.bth index 890e706..70fb0ea 100644 --- a/tests/func5.bth +++ b/tests/func5.bth @@ -1,4 +1,4 @@ -(set f (fn (a) (say (* a a)))) +(set! f (fn (a) (say (* a a)))) (f 2) (f 4) (f 6) diff --git a/tests/mandel.bth b/tests/mandel.bth index e75d694..43dc58b 100644 --- a/tests/mandel.bth +++ b/tests/mandel.bth @@ -1,20 +1,20 @@ -(set pxy 0) +(set! pxy 0) (while (< pxy 30) - (set cim (/ (- pxy 15) 15)) - (set pxx 0) + (set! cim (/ (- pxy 15) 15)) + (set! pxx 0) (while (< pxx 60) - (set cre (/ (- pxx 40) 20)) - (set i 0) - (set zim cim) - (set zre cre) + (set! cre (/ (- pxx 40) 20)) + (set! i 0) + (set! zim cim) + (set! zre cre) (while (< i 25) - (set nzre (+ cre (- (* zre zre) (* zim zim)))) - (set nzim (+ cim (* 2 (* zre zim)))) - (set zre nzre) - (set zim nzim) - (set mag (+ (* zre zre) (* zim zim))) - (set i (if (< mag 4) (+ i 1) 999))) + (set! nzre (+ cre (- (* zre zre) (* zim zim)))) + (set! nzim (+ cim (* 2 (* zre zim)))) + (set! zre nzre) + (set! zim nzim) + (set! mag (+ (* zre zre) (* zim zim))) + (set! i (if (< mag 4) (+ i 1) 999))) (write (if (< mag 4) "#" ".")) - (set pxx (+ pxx 1))) + (set! pxx (+ pxx 1))) (say "") - (set pxy (+ pxy 1))) + (set! pxy (+ pxy 1))) diff --git a/tests/mandel_local.bth b/tests/mandel_local.bth index 2cfa814..5b7fb9b 100644 --- a/tests/mandel_local.bth +++ b/tests/mandel_local.bth @@ -11,13 +11,13 @@ nzre 0 nzim 0) (while (< i 25) - (set nzre (+ cre (- (* zre zre) (* zim zim)))) - (set nzim (+ cim (* 2 (* zre zim)))) - (set zre nzre) - (set zim nzim) - (set mag (+ (* zre zre) (* zim zim))) - (set i (if (< mag 4) (+ i 1) 999))) + (set! nzre (+ cre (- (* zre zre) (* zim zim)))) + (set! nzim (+ cim (* 2 (* zre zim)))) + (set! zre nzre) + (set! zim nzim) + (set! mag (+ (* zre zre) (* zim zim))) + (set! i (if (< mag 4) (+ i 1) 999))) (write (if (< mag 4) "#" ".")) - (set pxx (+ pxx 1))))) + (set! pxx (+ pxx 1))))) (say "") - (set pxy (+ pxy 1)))) + (set! pxy (+ pxy 1)))) diff --git a/tests/map.bth b/tests/map.bth index aa9f45e..9f739bb 100644 --- a/tests/map.bth +++ b/tests/map.bth @@ -1,12 +1,12 @@ -(set map' (fn (f ix in out) +(set! map' (fn (f ix in out) (if (< ix (len in)) (let (elem (in ix) felem (f elem) newix (+ 1 ix)) - (set (out ix) felem) + (set! (out ix) felem) (map' f newix in out)) out))) -(set map (fn (f in) (map' f 0 in (arr)))) +(set! map (fn (f in) (map' f 0 in (arr)))) (let (a [1 2 3 4 5 6 7 8 9] f1 (fn (x) (* 10 x)) diff --git a/tests/sumrec.bth b/tests/sumrec.bth index 0bbf2b6..0d493e0 100644 --- a/tests/sumrec.bth +++ b/tests/sumrec.bth @@ -1,7 +1,7 @@ -(set f' (fn (x acc) +(set! f' (fn (x acc) (if (< x 1) acc (f' (- x 1) (+ acc x))))) -(set f (fn (x) (f' x 0))) +(set! f (fn (x) (f' x 0))) (say (f 10)) (say (f 1000)) diff --git a/tests/sumrec_local.bth b/tests/sumrec_local.bth index b40418b..e81eeb9 100644 --- a/tests/sumrec_local.bth +++ b/tests/sumrec_local.bth @@ -2,7 +2,7 @@ (if (< x 1) acc (f' (- x 1) (+ acc x)))) -(set _global_f' f') +(set! _global_f' f') (defn (f x) (_global_f' x 0)) (say (f 10)) (say (f 1000)) diff --git a/tests/vars.bth b/tests/vars.bth index 423dde6..aaa2a19 100644 --- a/tests/vars.bth +++ b/tests/vars.bth @@ -1,8 +1,8 @@ -(set a 5) -(set b 10) -(set thethe 1234) +(set! a 5) +(set! b 10) +(set! thethe 1234) (say (+ a b)) (say (- thethe a)) -(say (+ (set a 90) b)) +(say (+ (set! a 90) b)) (say a) nil diff --git a/tests/vars3.bth b/tests/vars3.bth index 149e694..6b3d6a4 100644 --- a/tests/vars3.bth +++ b/tests/vars3.bth @@ -1,5 +1,5 @@ -(set x 1) -(set y 10) +(set! x 1) +(set! y 10) (say (let (x 2) (let (y 20) (+ x y)))) diff --git a/tests/vars4.bth b/tests/vars4.bth index 30f75d3..ce1d3ed 100644 --- a/tests/vars4.bth +++ b/tests/vars4.bth @@ -1,7 +1,7 @@ -(set x 100) +(set! x 100) (say x) (let (x 20) (say x) - (set x 30) + (set! x 30) (say x)) (say x) diff --git a/tests/whilelet.bth b/tests/whilelet.bth index ce8a482..f4188ad 100644 --- a/tests/whilelet.bth +++ b/tests/whilelet.bth @@ -3,7 +3,7 @@ a []) (while (< i 10) (append a i) - (set i (+ i 1))) + (set! i (+ i 1))) (let (x 100 y 200 z 300) |