;; ;; Boolean primitives. ;; ;; Boolean test. (print "(boolean? true) -> ") (boolean? true) (print "(boolean? false) -> ") (boolean? false) (print "(boolean? 1) -> ") (boolean? 1) (print "(boolean? 5) -> ") (boolean? 5) (print "(boolean? \"string\") -> ") (boolean? "string") (print "(boolean? (+ 1 2 3)) -> ") (boolean? (+ 1 2 3)) (print "(boolean? (not 1)) -> ") (boolean? (not 1)) ;; Not. (print "(not true) -> ") (not true) (print "(not false) -> ") (not false) (print "(not (not true)) -> ") (not (not true)) (print "(not (not false)) -> ") (not (not false)) (print "(not 1) -> ") (not 1) (print "(not (not 1)) -> ") (not (not 1)) (print "(not \"string\") -> ") (not "string") (print "(not (not \"string\")) -> ") (not (not "string")) ;; And. (print "(and 1 \"string\" 4 true) -> ") (and 1 "string" 4 true) (print "(and true true true) -> ") (and true true true) (print "(and (+ 1 2 3)) -> ") (and (+ 1 2 3)) (print "(and false false false) -> ") (and false false false) (print "(and true false false) -> ") (and true false false) (print "(and false true false) -> ") (and false true false) (print "(and false true true) -> ") (and false true true) (print "(and (not false) true true) -> ") (and (not false) true true) ;; Or. (print "(or 1 \"string\" 4 true) -> ") (or 1 "string" 4 true) (print "(or false 1) -> ") (or false 1) (print "(or false \"string\") -> ") (or false "string") (print "(or false) -> ") (or false) (print "(or true true true) -> ") (or true true true) (print "(or false false false) -> ") (or false false false) (print "(or true false false) -> ") (or true false false) (print "(or false true false) -> ") (or false true false) (print "(or false true true) -> ") (or false true true) (print "(or (not false) true true) -> ") (or (not false) true true) (print "(or (not true) false) -> ") (or (not true) false) ;; If. (print "(if true true false) -> ") (if true true false) (print "(if false true false) -> ") (if false true false) (print "(if true (+ 1 2 3) 0) -> ") (if true (+ 1 2 3) 0) (print "(if false (+ 1 2 3) 0) -> ") (if false (+ 1 2 3) 0) (print "(if (or true false) (+ 1 2 3) (+ 7 8 9)) -> ") (if (or true false) (+ 1 2 3) (+ 7 8 9)) (print "(if (or false false) (+ 1 2 3) (+ 7 8 9)) -> ") (if (or false false) (+ 1 2 3) (+ 7 8 9)) (print "(if (or (+ 1 2 3) false) (+ 1 2 3) (+ 7 8 9)) -> ") (if (or (+ 1 2 3) false) (+ 1 2 3) (+ 7 8 9)) (print "(if true 7) -> ") (if true 7) (print "(if false 7) -> ") (if false 7)