1 ;; Testing non-macro function
4 ;;; This should fail if it is a macro
9 ;; Testing trivial macros
10 (defmacro! one (fn* () 1))
13 (defmacro! two (fn* () 2))
17 ;; Testing unless macros
18 (defmacro! unless (fn* (pred a b) `(if ~pred ~b ~a)))
23 (defmacro! unless2 (fn* (pred a b) `(if (not ~pred) ~a ~b)))
29 ;; Testing macroexpand
30 (macroexpand (unless2 2 3 4))
34 ;; Testing nth, first and rest functions
41 (def! x (nth '(1 2) 2))
71 (or false nil false false nil 4)
73 (or false nil 3 false nil 4)
88 (cond false 7 false 8 "else" 9)
90 (cond false 7 (= 2 2) 8 "else" 9)
92 (cond false 7 false 8 false 9)
97 (load-file "../core.mal")
112 (and 1 2 3 4 false 5)
119 (-> (list 7 8 9) first)
121 (-> (list 7 8 9) (first))
123 (-> (list 7 8 9) first (+ 7))
125 (-> (list 7 8 9) rest (rest) first (+ 7))
128 ;; Testing EVAL in let*
130 (let* (x (or nil "yes")) x)
134 ;; -------- Optional Functionality --------
136 ;; Testing nth, first, rest with vectors
143 (def! x (nth [1 2] 2))
160 ;; Testing EVAL in vector let*
162 (let* [x (or nil "yes")] x)