Next round of 4clojure.com solutions

After the fifth round, five more 4clojure.com solutions:

;;; Problem 50 - Split by Type
(deftest test-problem-50
  (let [v1 (fn [xs] (for [t (map type xs)] (filter #(= (type %) t) xs))) 
        v2 (fn [xs] (vals (group-by type xs)))
        __ v2]
    (is (= (set (__ [1 :a 2 :b 3 :c])) #{[1 2 3] [:a :b :c]}))
    (is (= (set (__ [:a "foo"  "bar" :b])) #{[:a :b] ["foo" "bar"]}))
    (is (= (set (__ [[1 2] :a [3 4] 5 6 :b])) #{[[1 2] [3 4]] [:a :b] [5 6]}))))
 
;;; Problem 49 - Split a sequence
(deftest test-problem-49
  (let [v1 (fn [n xs] [(take n xs) (drop n xs)]) 
        __ v1]
    (is (= (__ 3 [1 2 3 4 5 6]) [[1 2 3] [4 5 6]]))
    (is (= (__ 1 [:a :b :c :d]) [[:a] [:b :c :d]]))
    (is (= (__ 2 [[1 2] [3 4] [5 6]]) [[[1 2] [3 4]] [[5 6]]]))))
 
;;; Problem 48 - Intro to some
(deftest test-problem-48
  (let [v1 6 
        __ v1]
    (is (= __ (some #{2 7 6} [5 6 7 8])))
    (is (= __ (some #(when (even? %) %) [5 6 7 8])))))

;;; Problem 47 - Contain Yourself
(deftest test-problem-47
  (let [v1 4 
        __ v1]
    (is (contains? #{4 5 6} __))
    (is (contains? [1 1 1 1 1] __))
    (is (contains? {4 :a 2 :b} __))
    ; No longer works in CLojure 1.5+: http://clojuredocs.org/clojure_core/clojure.core/contains_q
    ; (is (not (contains? '(1 2 4) __))) 
    ))

;;; Problem 46 - Flipping out
(deftest test-problem-46
  (let [v1 (fn [f] #(f %2 %)) 
        __ v1]
    (is (= 3 ((__ nth) 2 [1 2 3 4 5])))
    (is (= true ((__ >) 7 8)))
    (is (= 4 ((__ quot) 2 8)))
    (is (= [1 2 3] ((__ take) [1 2 3 4 5] 3)))))

(run-tests)