(cons (list 1) (list 2 3))
;=>((1) 2 3)
+(def! a (list 2 3))
+(cons 1 a)
+;=>(1 2 3)
+a
+;=>(2 3)
+
;; Testing concat function
(concat)
;=>()
;=>(1 2 3 4 5 6)
(concat (concat))
;=>()
+(concat (list) (list))
+;=>()
+(def! a (list 1 2))
+(def! b (list 3 4))
+(concat a b (list 5 6))
+;=>(1 2 3 4 5 6)
+a
+;=>(1 2)
+b
+;=>(3 4)
;; Testing regular quote
(quote 7)
;=>7
-'7
-;=>7
(quote (1 2 3))
;=>(1 2 3)
-'(1 2 3)
-;=>(1 2 3)
(quote (1 2 (3 4)))
;=>(1 2 (3 4))
-'(1 2 (3 4))
-;=>(1 2 (3 4))
-
;; Testing simple quasiquote
(quasiquote 7)
;=>7
-`7
-;=>7
(quasiquote (1 2 3))
;=>(1 2 3)
-`(1 2 3)
-;=>(1 2 3)
(quasiquote (1 2 (3 4)))
;=>(1 2 (3 4))
-`(1 2 (3 4))
-;=>(1 2 (3 4))
(quasiquote (nil))
;=>(nil)
-`(nil)
-;=>(nil)
-
;; Testing unquote
-`~7
+(quasiquote (unquote 7))
;=>7
(def! a 8)
;=>8
-`a
+(quasiquote a)
;=>a
-`~a
+(quasiquote (unquote a))
;=>8
-`(1 a 3)
+(quasiquote (1 a 3))
;=>(1 a 3)
-`(1 ~a 3)
+(quasiquote (1 (unquote a) 3))
;=>(1 8 3)
-(def! b '(1 "b" "d"))
+(def! b (quote (1 "b" "d")))
;=>(1 "b" "d")
-`(1 b 3)
+(quasiquote (1 b 3))
;=>(1 b 3)
-`(1 ~b 3)
+(quasiquote (1 (unquote b) 3))
;=>(1 (1 "b" "d") 3)
-
+(quasiquote ((unquote 1) (unquote 2)))
+;=>(1 2)
;; Testing splice-unquote
-(def! c '(1 "b" "d"))
+(def! c (quote (1 "b" "d")))
;=>(1 "b" "d")
-`(1 c 3)
+(quasiquote (1 c 3))
;=>(1 c 3)
-`(1 ~@c 3)
+(quasiquote (1 (splice-unquote c) 3))
;=>(1 1 "b" "d" 3)
;; Testing symbol equality
-(= 'abc 'abc)
+(= (quote abc) (quote abc))
;=>true
-(= 'abc 'abcd)
+(= (quote abc) (quote abcd))
;=>false
-(= 'abc "abc")
+(= (quote abc) "abc")
;=>false
-(= "abc" 'abc)
+(= "abc" (quote abc))
;=>false
-(= "abc" (str 'abc))
+(= "abc" (str (quote abc)))
;=>true
+(= (quote abc) nil)
+;=>false
+(= nil (quote abc))
+;=>false
;;;;; Test quine
;;; TODO: needs expect line length fix
;;;((fn* [q] (quasiquote ((unquote q) (quote (unquote q))))) (quote (fn* [q] (quasiquote ((unquote q) (quote (unquote q)))))))
;;;=>((fn* [q] (quasiquote ((unquote q) (quote (unquote q))))) (quote (fn* [q] (quasiquote ((unquote q) (quote (unquote q)))))))
+;>>> deferrable=True
+;;
+;; -------- Deferrable Functionality --------
+
+;; Testing ' (quote) reader macro
+'7
+;=>7
+'(1 2 3)
+;=>(1 2 3)
+'(1 2 (3 4))
+;=>(1 2 (3 4))
+
+;; Testing ` (quasiquote) reader macro
+`7
+;=>7
+`(1 2 3)
+;=>(1 2 3)
+`(1 2 (3 4))
+;=>(1 2 (3 4))
+`(nil)
+;=>(nil)
+
+;; Testing ~ (unquote) reader macro
+`~7
+;=>7
+(def! a 8)
+;=>8
+`(1 ~a 3)
+;=>(1 8 3)
+(def! b '(1 "b" "d"))
+;=>(1 "b" "d")
+`(1 b 3)
+;=>(1 b 3)
+`(1 ~b 3)
+;=>(1 (1 "b" "d") 3)
+
+;; Testing ~@ (splice-unquote) reader macro
+(def! c '(1 "b" "d"))
+;=>(1 "b" "d")
+`(1 c 3)
+;=>(1 c 3)
+`(1 ~@c 3)
+;=>(1 1 "b" "d" 3)
+
+
+;>>> optional=True
;;
;; -------- Optional Functionality --------
-;; Testing cons, concat, first, rest with vectors
+;; Testing cons and concat with vectors
(cons [1] [2 3])
;=>([1] 2 3)
;=>(1 2 3)
(concat [1 2] (list 3 4) [5 6])
;=>(1 2 3 4 5 6)
+(concat [1 2])
+;=>(1 2)
;; Testing unquote with vectors
(def! a 8)