Solutions for problems on 4clojure (http://www.4clojure.com/)
true
4
"HELLO WORLD"
:a :b :c
'(1 2 3 4)
:a :b :c
[1 2 3 4]
#{:a :b :c :d}
2
20
{:b 2}
3
[20 30 40]
8
* 2
(fn [name]
(str "Hello, " name "!"))
'(6 7 8)
'(6 7)
#(nth % (dec (count %)))
#(nth % (- (count %) 2))
#(get (into [] %1) %2)
#(reduce + (vals (frequencies %)))
#(reduce conj () %)
reduce +
filter odd?
#(= (seq %) (reverse %))
#(apply str (re-seq #"[A-Z]" %))
#(map first (partition-by identity %))
partition-by identity
#(interleave % %)
#(mapcat (fn [x] (repeat %2 x)) %1)
#(take (- %2 %1) (iterate inc %1))
7
[x 7 y 3 z 1]
"ABC"
#(last (sort %&))
#(flatten (map list %1 %2))
#(reduce * (range 1 (inc %)))
'(1 4 7 10 13)
4
6
#(vector (subvec %2 0 %1) (subvec %2 %1))
[1 2 3 4 5]
[c e]
'(5 4 3 2 1)
#(apply hash-map (interleave %1 %2))
+
[7 6 5 4 3]
last
reduce +
(fn [& bools]
(let [true-count (get (frequencies bools) true 0)
total-count (count bools)]
(and (> true-count 0) (< true-count total-count))))
(fn [x y]
(->> (* x y)
str
(map (comp read-string str))))
(fn [k m]
(if (contains? m k)
(= (m k) nil)
false))
(fn [x y]
(->> (map * x y)
(reduce +)))
'(1 5 9 13 17 21 25 29 33 37)
#(zipmap %2 (repeat %1))
#{1 2}
162. Logical falsity and truth
1