Do you splisp ?


    (is true)

    (isnt false)




    (isnt nil)




    (is 1)

    (is 1 1)

    (isnt 1 2)

    (is (number? 1))




    (is 'a)

    (is 'foo 'foo)

    (isnt 'a 'foo)

    (is (symbol? 'baz))

    (isnt (number? 'qux))

    (isnt (symbol? 42))



    (is (true? true))

    (is (false? false))

    (is (nil? nil))

    (isnt (false? true))

    (isnt (false? nil))


    (is (not false))

    (is (not nil))

    (isnt (not true))

    (isnt (not 42))


    (is (or true false))

    (is (or false true))

    (is (or true nil))

    (is (or nil 42) 42)

    (is (or 'foo 23) 'foo)

    (is (and true true))

    (is (and true 1 'bar) 'bar)

    (isnt (or false false))

    (isnt (and true false))

    (isnt (and 1 'foo false))




    (is (cons 3 7))

    (is (cons 'age 13))

    (is (cons 'hello 'world))

    (is (cons? (cons 11 0)))




    (is (atom? 42))

    (is (atom? 'sym))

    (isnt (atom? (cons 'car 'cdr)))




    (is (car (cons 1 2))
        1)

    (is (cdr (cons 'a 'b))
        'b)

    (is (list 1)
        (cons 1 nil))

    (is (list 1 2)
        (cons 1 (list 2))
        (cons 1 (cons 2 nil)))



    (is (fn [x] x))

    (is ((fn [x] x) 1)
        1)

    (is ((fn [x] x) 'a)
        'a)

    (is (fn [x] (cons x x)))

    (is ((fn [x] (cons x x)) 1)
        (cons 1 1))

    (is (fn [x y] (cons x y)))

    (is ((fn [x y] (cons x y)) 1 'a)
        (cons 1 'a))




    (isnt x)

    (be x 1)

    (is x)

    (is x 1)

    (is x x)

    (be y (cons x x))

    (is y (cons 1 1))

    (be f (fn [x] x))

    (is f)

    (is (f 1) 1)

    (be g (fn [x y] (cons x y)))

    (is (g 1 2)
        (cons 1 2))

    (is (g 1 (g 2 nil))
        (cons 1 (g 2 nil))
        (cons 1 (cons 2 nil))
        (list 1 2))

    (be h cons)

    (is (h 1 2)
        (cons 1 2))

    (be n number?)

    (is (n 42))



    (is (if true 'ok))

    (is (if (number? 1) 'ok)
        'ok)

    (isnt (if (number? 'a) 'yes))

    (is (if-not false 'yes)
        'yes)

    (isnt (if-not true 'nice))

    (is (cond (number? 'a) 'branch-1
              (number? 1) 'branch-2)
        'branch-2)

    (is (cond (number? 1) 'a
              (symbol? 'a) 'b
              (cons? 2) 'c)
        'a)

    (be f (fn [x]
            (cond (number? x) (cons 'num x)
                  (symbol? x) (cons 'sym x)
                  (cons? x) (cons 'cons x)
                  :else (cons 'unknown x))))

    (is (f 1)
        (cons 'num 1))

    (is (f 'foo)
        (cons 'sym 'foo))

    (is (f (cons 1 2))
        (cons 'cons (cons 1 2)))

    (is (f "I'm a string")
        (cons 'unknown "I'm a string"))



    (be countdown
        (fn [n]
          (if (zero? n)
            'done
            (countdown (dec n)))))

    (is (countdown 5)
        (countdown 10)
        'done)


    (be take
        (fn [xs n]
          (cond (nil? xs) xs
                (zero? n) nil
                'else (cons (car xs)
                            (take (cdr xs) (dec n))))))

    (is (take (list 1 2 3 4) 2)
        (list 1 2))