(examples-for sqrt

("sqrt"
 (sqrt 6.25)
 2.5))

(examples-for eq?

("is nil for two different dates"
 (eq? (today) (+ (today) 1))
 nil)

("is true for two identical dates"
 (eq? (date 2015 3 12) (+ (date 2015 3 1) 11))
 t)

("true for two empty symbols"
 (eq? '|| '||)
 t)

("true for two identical numbers"
 (eq? 42 42)
 t)

("true for three identical numbers"
 (eq? 42 42 42)
 t)

("true for four identical numbers"
 (eq? 42 42 42 42)
 t)

("true for five identical numbers"
 (eq? 42 42 42 42 42)
 t)

("true for six identical numbers"
 (eq? 42 42 42 42 42 42)
 t)

("false for one different number in six"
 (eq? 42 42 42 42 42 -3)
 nil)

("false for one different number in five"
 (eq? 42 42 42 -3 42)
 nil)

("false for one different number in four"
 (eq? 42 -3 42 42)
 nil)

("false for one different number in three"
 (eq? -3 42 42)
 nil)

("false for two different numbers"
 (eq? -3 42)
 nil)

("nil for two different symbols"
 (eq? 'foo 'bar)
 nil))

(examples-for =

("assigns a symbol"
 (pre-compile '(= this 'that))
 (assign this 'that)))

(examples-for if

("single-expr 'if is just the expr"
 (pre-compile '(if a))
 a)

("two-expr 'if expands to 'cond"
 (pre-compile '(if a b))
 (cond a b))

("three-expr 'if expands to 'cond"
 (pre-compile '(if a b c))
 (cond a b c))

("four-expr 'if expands to nested 'cond"
 (pre-compile '(if a b c d))
 (cond a b (cond c d)))

("five-expr 'if expands to nested 'cond"
 (pre-compile '(if a b c d e))
 (cond a b (cond c d e)))

("t is boolean true"
 (if t "hello" "goodbye")
 "hello")

("function condition"
 (if (> 5 3) "hello" "goodbye")
 "hello")

("function condition and outcome"
 (if (> 5 3) (+ 5 3) (- 5 3))
 8)

("global symbol : true"
 (do (assign global-symbol-if-test 1)
     (if global-symbol-if-test "yes" "no"))
 "yes")

("global symbol : false"
 (do (assign global-symbol-if-test nil)
     (if global-symbol-if-test "yes" "no"))
 "no")

("condition and when-true are the same ; literal when-false (true)"
 (let x 1 (if x x "no"))
 1)

("condition and when-true are the same ; literal when-false (false)"
 (let x nil (if x x "no"))
 "no")

("condition and when-true are the same ; cond when-false (true)"
 (with (x 1 y 2) (if x x (if y y "else")))
 1)

("condition and when-true are the same ; cond when-false (false/true)"
 (with (x nil y 2) (if x x (if y y "else")))
 2)

("condition and when-true are the same ; cond when-false (false/false)"
 (with (x nil y nil) (if x x (if y y "else")))
 "else")

("locally-bound condition: true"
 (let x 1 (if x "yes" "no"))
 "yes")

("locally-bound condition: false"
 (let x nil (if x "yes" "no"))
 "no")

("locally-bound cond and truth : true"
 (with (x 1 y "yes") (if x y "no"))
 "yes")

("locally-bound cond and truth : false"
 (with (x nil y "yes") (if x y "no"))
 "no")

("cond with locally-bound condition, conditional if true, literal when false : true/false"
 (let x 1 (if x (if (> x 5) "wrong" "right") "otherwise"))
 "right")

("cond with locally-bound condition, conditional if true, literal when false : true/true"
 (let x 22 (if x (if (> x 5) "wrong" "right") "otherwise"))
 "wrong")

("cond with locally-bound condition, conditional if true, literal when false : false"
 (let x nil (if x (if (> x 5) "wrong" "right") "otherwise"))
 "otherwise")

("nil is boolean false"
 (if nil "hello" "goodbye")
 "goodbye"))

(examples-for unless

("expands to negative 'if"
 (pre-compile '(unless x y z))
 (cond (no x) ((fn () y z)))))

(examples-for fn

("argument default value is nil"
 ( (fn (x y z) (list x y (car z))) 'a 'b )
 (a b nil)))

(examples-for do

("executes its content"
 (let premesolithic 3
   (do
     (assign premesolithic (* premesolithic 4))
     (let jurassic 17
       (do
         (= jurassic (+ jurassic premesolithic))
         (= premesolithic (+ jurassic premesolithic))
         (* premesolithic 2)))))
 82))