16a3589a3a8405f128fe87a456cacb4a63c1d2f2
[jackhill/mal.git] / tests / step2_eval.mal
1 ;; Testing evaluation of arithmetic operations
2 (+ 1 2)
3 ;=>3
4
5 (+ 5 (* 2 3))
6 ;=>11
7
8 (- (+ 5 (* 2 3)) 3)
9 ;=>8
10
11 (/ (- (+ 5 (* 2 3)) 3) 4)
12 ;=>2
13
14 (/ (- (+ 515 (* 87 311)) 302) 27)
15 ;=>1010
16
17 (* -3 6)
18 ;=>-18
19
20 (/ (- (+ 515 (* -87 311)) 296) 27)
21 ;=>-994
22
23 ;;; This should throw an error with no return value
24 (abc 1 2 3)
25 ;/.+
26
27 ;; Testing empty list
28 ()
29 ;=>()
30
31 ;>>> deferrable=True
32 ;>>> optional=True
33 ;;
34 ;; -------- Deferrable/Optional Functionality --------
35
36 ;; Testing evaluation within collection literals
37 [1 2 (+ 1 2)]
38 ;=>[1 2 3]
39
40 {"a" (+ 7 8)}
41 ;=>{"a" 15}
42
43 {:a (+ 7 8)}
44 ;=>{:a 15}