1 2 | (((fn [n] (fn [x] (apply * (repeat n x)))) 2 ) 16 ) 256 |
1 2 | ((partial (fn [n x] (apply * (repeat n x))) 2 ) 16 ) 256 |
1 2 | (((fn [n] (fn [x] (apply * (repeat n x)))) 2 ) 16 ) 256 |
1 2 | ((partial (fn [n x] (apply * (repeat n x))) 2 ) 16 ) 256 |
1 2 | ((fn [kvect, vvect] (apply hash-map (interleave kvect vvect))) [:a :b :c] [ 1 2 3 ]) {:c 3 , :b 2 , :a 1 } |
1 2 | ((fn [s n] (mapcat (fn [x] (repeat n x)) s)) [ 1 2 3 ] 2 ) (( 1 1 2 2 3 3 )) |
1 2 | ((fn interlive [s1 s2] (mapcat vector s1 s2)) [:a :b :c] [ 1 2 3 ]) (:a 1 :b 2 :c 3 ) |
1 2 | ((fn flat [s] ( if (sequential? s) (mapcat flat s) [s])) '(( 1 2 ) 3 [ 4 [ 5 6 ]])) ( 1 2 3 4 5 6 ) |
1 2 | (#(map first (partition-by identity %)) [ 1 1 2 3 3 2 2 3 ]) [ 1 2 3 2 3 ] |
1 2 | ((fn [n] (map second (take n (iterate (fn [[a b]] [b (+ a b)]) [ 0 1 ])))) 6 ) ( 1 1 2 3 5 8 ) |
1 2 | ((fn [defval vect] (reduce (fn [m k] (conj m {k defval})) {} vect)) 0 [:a :b]) {:a 0 , :b 0 } |
1 2 | ((fn [defval vect] (zipmap vect (repeat defval))) 0 [:a :b :c]) {:a 0 , :b 0 , :c 0 } |
1 2 | (reduce (fn [m [k v]] (assoc m k (inc v))) {} {:a 1 :b 2 }) {:a 2 , :b 3 } |
1 2 | (reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 1 :b 2 }) {:a 2 , :b 3 } |