-
Notifications
You must be signed in to change notification settings - Fork 111
/
tests-1.6-opt.scm
45 lines (43 loc) · 922 Bytes
/
tests-1.6-opt.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(add-tests-with-string-output "let*"
[(let* ([x 5]) x) => "5\n"]
[(let* ([x (fx+ 1 2)]) x) => "3\n"]
[(let* ([x (fx+ 1 2)]
[y (fx+ 3 4)])
(fx+ x y))
=> "10\n"]
[(let* ([x (fx+ 1 2)]
[y (fx+ 3 4)])
(fx- y x))
=> "4\n"]
[(let* ([x (let* ([y (fx+ 1 2)]) (fx* y y))])
(fx+ x x))
=> "18\n"]
[(let* ([x (fx+ 1 2)]
[x (fx+ 3 4)])
x)
=> "7\n"]
[(let* ([x (fx+ 1 2)]
[x (fx+ x 4)])
x)
=> "7\n"]
[(let* ([t (let* ([t (let* ([t (let* ([t (fx+ 1 2)]) t)]) t)]) t)]) t)
=> "3\n"]
[(let* ([x 12]
[x (fx+ x x)]
[x (fx+ x x)]
[x (fx+ x x)])
(fx+ x x))
=> "192\n"]
)
(add-tests-with-string-output "let vs let*"
[(let ([x 1])
(let ([x (fx+ x 1)]
[y (fx+ x 1)])
y))
=> "2\n"]
[(let* ([x 1])
(let* ([x (fx+ x 1)]
[y (fx+ x 1)])
y))
=> "3\n"]
)