((juxt (comp first filter) some) pos? [0 -1 2 1 0])
[2 true]
(nth (iterate (comp #(apply hash-map %) (juxt identity identity)) {}) 4)
{{{{{} {}} {{} {}}} {{{} {}} {{} {}}}} {{{{} {}} {{} {}}} {{{} {}} {{} {}}}}}
(defn vals->vector [m] (into {} (map (juxt key (comp vector val)) m)))
#'user/vals->vector
(map (comp (partial apply zipmap) (juxt (comp list :pos) (comp list vector :step))) [{:step 1, :pos :s1} {:step 2, :pos :s2}])
({:s1 [1]} {:s2 [2]})
(map (comp (partial apply zipmap) (partial (juxt (comp vector :pos) (comp vector vector :step)))) [{:step 1, :pos :s1} {:step 2, :pos :s2}])
({:s1 [1]} {:s2 [2]})
(defn juxtcat [& args] (comp (partial apply concat) (apply juxt args)))
#'user/juxtcat
(map (juxt identity (comp (partial * 2) inc)) [1 2 3])
([1 4] [2 6] [3 8])
((juxt some (comp first filter)) odd? [2 4 6 5 7])
[true 5]
(into {} (map (juxt key (comp inc val)) {:a 1, :b 2}))
{:a 2, :b 3}
(-> 321 Integer/toString ((partial repeat 2)) ((juxt first (comp reverse second))))
["321" (\1 \2 \3)]
(into {} (map (juxt (comp keyword str hash) identity) ["a" "b" "c"]))
{:1219591486 "c", :1455541201 "a", :516420758 "b"}
((juxt (comp count filter) (comp count remove)) #(= "1.0" (:added %)) (map meta (vals (ns-publics 'clojure.core))))
[0 538]
(map (comp (partial apply hash-map) (juxt :pos (comp vector :step))) [{:step 1, :pos :s1} {:step 2, :pos :s2}])
({:s1 [1]} {:s2 [2]})
(defn fork [f g h] (comp (partial apply f) (juxt g h)))
#'user/fork
((comp (partial apply /) (juxt (partial apply +) count)) [1 2 3])
2
(apply concat ((juxt take (comp rest drop)) 2 [1 2 3 4]))
(1 2 4)
(into {} (map (juxt (comp keyword str) identity) [0 1 2 3 4]))
{:0 0, :1 1, :2 2, :3 3, :4 4}
(into {} (map (juxt (comp keyword str) (constantly 0)) [0 1 2 3 4]))
{:0 0, :1 0, :2 0, :3 0, :4 0}
((comp first (partial nth (iterate (juxt second (partial apply +)) [1 1]))) 6)
13
(map (comp (partial interleave [1 2 3]) (juxt inc dec)) [5 10 15])
((1 6 2 4) (1 11 2 9) (1 16 2 14))
(into {} (map (juxt key (comp inc val)) {:a 1, :b 2, :c 3}))
{:a 2, :b 3, :c 4}
((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 3])
false
(map (comp (juxt (partial every? identity) (comp not (partial some nil?))) vals) [{:a nil, :b false} {:a "hi", :b false}])
([false false] [false true])
(some (partial apply =) ((comp (partial apply map list) (juxt identity rest)) "somestring"))
nil
(some (partial apply =) ((comp (partial apply map list) (juxt identity rest)) "someestring"))
true
((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 2])
true
((comp (partial apply map vector) (juxt identity (comp reverse (partial take-while first) (partial iterate pop) pop))) [:a :b :c :d])
([:a [:a]] [:b [:a :b]] [:c [:a :b :c]])
(let [boolean? (comp (partial apply =) (juxt identity boolean))] (map boolean? [1 true false]))
(false true true)
(-> 321 Integer/toString ((partial repeat 2)) ((juxt first (comp reverse second))) ((partial apply concat)))
(\3 \2 \1 \1 \2 \3)
((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] '(1 2))
false
(#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2, 3 4})
{1 3, 3 5}
((comp first ((partial juxt (resolve (symbol (apply str (map char '(105 110 99)))))))) 1)
2
((comp (partial apply hash-map) (juxt (constantly :a) :a (constantly :inner_a) (comp :inner_a :user))) {:a 2, :b 3, :user {:inner_a 5, :inner_b 9}})
{:a 2, :inner_a 5}
((comp (partial apply map max) (juxt identity rest)) [1 5 4 3 2 6 7])
(5 5 4 3 6 7)
((comp first (partial apply drop) (juxt second first) vector) [:a :b :c :d :e] 3)
:d
((juxt (partial take-nth 2) (comp (partial take-nth 2) rest)) [1 2 3 4 5 6])
[(1 3 5) (2 4 6)]
(apply into ((juxt empty (partial remove (comp even? val))) {:a 1, :b 2, :c 3}))
{:a 1, :c 3}
(map (juxt #(apply vector %) #(apply (comp reverse vector) %)) ["foo" "bar" "baz"])
([[\f \o \o] (\o \o \f)] [[\b \a \r] (\r \a \b)] [[\b \a \z] (\z \a \b)])
((apply juxt (map (partial comp set) [filter remove])) odd? #{1 2 3 4 5})
[#{1 3 5} #{2 4}]
((comp first (partial apply drop) (juxt second first) vector) [:a :b :c :P :e] 3)
:P
(->> [1 true false nil] (map (juxt (comp not not) boolean)) (every? (partial apply =)))
true
(map (comp (partial apply hash-map) (juxt key (comp :c val))) {:one {:a 1, :b 2, :c 3}, :two {:a 10, :b 20, :c 30}})
({:one 3} {:two 30})
(let [append-to-self (comp (partial apply conj) (juxt (fnil identity []) identity))] (map append-to-self [[] [1] [2 3] nil]))
([[]] [1 [1]] [2 3 [2 3]] [nil])
(sort-by (juxt :otherkey (comp count :key)) (comp - compare) [{:key '(1 2 3 4), :otherkey 10} {:key '(1 2 3), :otherkey 12}])
({:key (1 2 3), :otherkey 12} {:key (1 2 3 4), :otherkey 10})
((apply juxt (map #(comp set %) [filter remove])) odd? #{1 2 3 4 5})
[#{1 3 5} #{2 4}]
(sort-by (juxt (comp - first) second) [[1 2] [2 1] [3 3] [2 3] [3 2]])
([3 2] [3 3] [2 1] [2 3] [1 2])
((juxt (partial take 3) (comp (partial take 1) (partial drop 3)) (comp (partial take 2) (partial drop 4))) (re-seq #"\w+" "blah blah blah blah blah blah"))
[("blah" "blah" "blah") ("blah") ("blah" "blah")]
(let [s [1 5 4 3 2 6 7]] ((comp (partial apply map max) (juxt identity rest)) s))
(5 5 4 3 6 7)
(let [m {:a 1, :b 2, :c 3}] (into (empty m) (map (juxt key (comp inc val)) m)))
{:a 2, :b 3, :c 4}
(apply (fn [a b] (a b)) ((apply juxt (map (fn [length] (comp second #(nth % length))) [27 15])) (filter (comp #{\?} last name first) (seq (ns-map *ns*)))))
false