forth: Add . interop special operator and tests
[jackhill/mal.git] / tests / step3_env.mal
CommitLineData
31690700
JM
1;; Testing REPL_ENV
2(+ 1 2)
3;=>3
4(/ (- (+ 5 (* 2 3)) 3) 4)
5;=>2
6
7
8;; Testing def!
9(def! x 3)
10;=>3
11x
12;=>3
13(def! x 4)
14;=>4
15x
16;=>4
17(def! y (+ 1 7))
18;=>8
19y
20;=>8
21
22
23;; Testing let*
24(let* (z 9) z)
25;=>9
26(let* (x 9) x)
27;=>9
28x
29;=>4
30(let* (z (+ 2 3)) (+ 1 z))
31;=>6
32(let* (p (+ 2 3) q (+ 2 p)) (+ p q))
33;=>12
34
9af8aee6
JM
35;;
36;; -------- Optional Functionality --------
31690700 37
f5223195
JM
38;; Testing let* with vector bindings
39(let* [z 9] z)
40;=>9
41(let* [p (+ 2 3) q (+ 2 p)] (+ p q))
42;=>12
43
31690700
JM
44;; Testing vector evaluation
45(let* (a 5 b 6) [3 4 a [b 7] 8])
46;=>[3 4 5 [6 7] 8]