add Clojure and its dialects to /samples

This commit is contained in:
Hoàng Minh Thắng
2013-04-15 13:57:56 +07:00
parent b68732f0c7
commit 3bbeea3682
7 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
(deftest function-tests
(is (= 3
(count [1 2 3])))
(is (= false
(not true)))
(is (= true
(contains? {:foo 1 :bar 2} :foo)))
(is (= {"foo" 1, "baz" 3}
(select-keys {:foo 1 :bar 2 :baz 3} [:foo :baz])))
(is (= [1 2 3]
(vals {:foo 1 :bar 2 :baz 3})))
(is (= ["foo" "bar" "baz"]
(keys {:foo 1 :bar 2 :baz 3})))
(is (= [2 4 6]
(filter (fn [x] (=== (rem x 2) 0)) [1 2 3 4 5 6]))))