((juxt :a :b) {:a 1, :b 2, :c 3})
[1 2]
((juxt keys vals) {:a 2, :b 3, :c 4})
[(:a :b :c) (2 3 4)]
(into {} (map (juxt val key) {:a 1, :b 2}))
{1 :a, 2 :b}
(map print ((juxt identity pr-str) {:a "hello", :b 'hello}))
(nil nil)
"{:a hello, :b hello}{:a \"hello\", :b hello}"
(map (juxt (comp count val) key) (group-by odd? [1 2 7 9 8 5 1 0 1]))
([6 true] [3 false])
((juxt type identity) (apply list `(a b c)))
[clojure.lang.PersistentList (user/a user/b user/c)]
(def square (comp (partial apply *) (juxt identity identity)))
#'user/square
(nth (iterate (juxt first second) '[first second]) 1000)
[first second]
((juxt :a :c) {:a 1, :b 2, :c 3})
[1 3]
((juxt keys vals) {:a 1, :b 2, :c 3})
[(:a :b :c) (1 2 3)]
(into {} (map (juxt keyword identity)) {"a" "b", "c" "d"})
{nil ["c" "d"]}
(map (juxt identity char) (range (int \a) (int \z)))
([97 \a] [98 \b] [99 \c] [100 \d] [101 \e] [102 \f] [103 \g] [104 \h] [105 \i] [106 \j] [107 \k] [108 \l] [109 \m] [110 \n] [111 \o] [112 \p] [113 \q] [114 \r] [115 \s] [116 \t] [117 \u] [118 \v] [119 \w] [120 \x] [121 \y])
(defn map-vals [f] (map (juxt key (comp f val))))
#'user/map-vals
(map print ((juxt str pr-str) {:a "hello", :b 'hello}))
(nil nil)
"{:a \"hello\", :b hello}{:a \"hello\", :b hello}"
((juxt meta first) (with-meta [1 2 3] {:foo "bar"}))
[{:foo "bar"} 1]
((juxt identity #(assoc % :a "1")) {:b "2"})
[{:b "2"} {:a "1", :b "2"}]
(map (juxt sequential? map? list? vector? seq?) [() [] #{} {} (lazy-seq)])
([true false true false true] [true false false true false] [false false false false false] [false true false false false] [true false false false true])
(defn decorate [obj & fns] ((apply juxt identity fns) obj))
#'user/decorate
(map (juxt :a :c) {:a 1, :b 2, :c 3})
([nil nil] [nil nil] [nil nil])
(apply map vector ((juxt vals keys) {:key1 1, :key2 2}))
([1 :key1] [2 :key2])
((juxt #(map count %)) [[1 2 3] [2 3]])
[(3 2)]
(first (filter (juxt identity println) '(0 1 2 3)))
0
"0\n"
((juxt identity meta) (tree-seq seq? identity (with-meta [1] {:m 1})))
[([1]) nil]
(first (filter (juxt println identity) (apply list [1 2 3])))
1
"1\n"
((juxt str pr-str) [1 2 [3 4] '(5 6)])
["[1 2 [3 4] (5 6)]" "[1 2 [3 4] ^{:line 1, :column 32} (5 6)]"]
((comp (partial apply str) (juxt namespace (constantly "/") name)) :foo/bar)
"foo/bar"
((juxt :a :b :c) {:a 1, :b 2, :c 3})
[1 2 3]
(* 2 (.length (str (macroexpand '((juxt namespace symbol) `'`'`'`a)))))
24716
(def funcall (comp (partial apply apply) (juxt first rest) list))
#'user/funcall
(into {} (map (juxt inc dec) '(1 2 3 4)))
{2 0, 3 1, 4 2, 5 3}
(conj {} ((juxt :key :value) {:key "the key", :value "the value"}))
{"the key" "the value"}
(take 10 (map (juxt identity #(* % %)) (range)))
([0 0] [1 1] [2 4] [3 9] [4 16] [5 25] [6 36] [7 49] [8 64] [9 81])
((juxt (partial reduce +) (partial reduce -)) [1 2 3])
[6 -4]
(every? identity ((juxt pos? even? #(< % 10)) 10))
false
((juxt :a :b :c) {:a 1, :b 2, :c 42})
[1 2 42]
(defn rand-pair-from-hashmap [hmap] (-> hmap keys rand-nth ((juxt identity hmap))))
#'user/rand-pair-from-hashmap
((juxt + max min) 2 3 5 1 6 4)
[21 6 1]
((juxt dissoc get) {:a 0, :b 1, :c 2} :b)
[{:a 0, :c 2} 1]
(true? (apply = (map (juxt first rest next) [() [] #{} {} nil])))
true
(map (juxt :a :b) [{:a 1, :b 2, :c 3}])
([1 2])
(every? identity ((juxt pos? even? #(< % 10)) 8))
true
(map (juxt identity #(* % %)) (range 0 6))
([0 0] [1 1] [2 4] [3 9] [4 16] [5 25])
((juxt filter remove) (fn [_] (< (rand) 0.5)) (range 10))
[(0 5 8) (0 2 4 6 7 8 9)]
(mapv (juxt first (comp inc second)) [["a" 0] ["b" 1]])
[["a" 1] ["b" 2]]
((juxt #(* 2 %) #(vector 2 %)) 3)
[6 [2 3]]
(into {} (map (juxt keyword identity) [0 1 2 3 4]))
{nil 4}
((juxt :a :b :c) {:a 1, :b 4, :c 9})
[1 4 9]
((juxt :foo :bar :baz) {:bar 2, :baz 3, :foo 1})
[1 2 3]
(into {} (map (juxt identity #(* % 2)) (range 10)))
{0 0, 1 2, 2 4, 3 6, 4 8, 5 10, 6 12, 7 14, 8 16, 9 18}
(into {} (map (comp (juxt :name :doc) meta)) (ns-publics (the-ns 'clojure.core)))
{nil nil}