(map (juxt not-empty (comp not empty) (comp not empty?)) [nil [] [1 2 3]])
([nil true false] [nil false false] [[1 2 3] false true])
((juxt namespace name) (keyword "well that's cheating, but this keyword / is worse"))
["well that's cheating, but this keyword " " is worse"]
(map (juxt str pr-str) [[1 2 3] ["1" "2" "3"] [\1 \2 \3]])
(["[1 2 3]" "[1 2 3]"] ["[\"1\" \"2\" \"3\"]" "[\"1\" \"2\" \"3\"]"] ["[\\1 \\2 \\3]" "[\\1 \\2 \\3]"])
(let [[a b] ((juxt + *) 2 3)] (str a " and " b))
"5 and 6"
(let [boolean? (comp (partial apply =) (juxt identity boolean))] (map boolean? [1 true false]))
(false true true)
(map (juxt identity true? false? boolean) [0 5 {} [] "foo" :bar 'baz true false nil])
([0 false false true] [5 false false true] [{} false false true] [[] false false true] ["foo" false false true] [:bar false false true] [baz false false true] [true true false true] [false false true false] [nil false false false])
((juxt #(apply max %) last) (reductions + 0 [1 2 -30 8 12]))
[3 -7]
(apply zipmap ((juxt (comp list :pos) (comp list vector :step)) {:step 1, :pos :s1}))
{:s1 [1]}
(-> 321 Integer/toString ((partial repeat 2)) ((juxt first (comp reverse second))) ((partial apply concat)))
(\3 \2 \1 \1 \2 \3)
(clojure.walk/postwalk (juxt identity meta) {:a 1, :b (-> '(f x) (with-meta {:m 1}))})
[{[[:a nil] [1 nil]] nil, [[:b nil] [([f nil] [x nil]) nil]] nil} nil]
((fn [n] (first (nth (iterate (juxt second (partial apply +)) [1 1]) n))) 6)
13
(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3))
(true true true)
((juxt (partial apply str) (partial apply print-str)) [(lazy-seq ["a" "b"]) (lazy-seq [1 2])])
["clojure.lang.LazySeq@fe2clojure.lang.LazySeq@3e2" "(a b) (1 2)"]
(apply map (juxt + - * /) [[1 2 3] [1 2 3]])
([2 0 1 1] [4 0 4 1] [6 0 9 1])
(map (juxt inc dec) [1 2 3 4 5 6 7 8 9])
([2 0] [3 1] [4 2] [5 3] [6 4] [7 5] [8 6] [9 7] [10 8])
((fn hash-by [f coll] (into {} (map (juxt f identity)) coll)) inc (range 5))
{1 0, 2 1, 3 2, 4 3, 5 4}
((fn rle [s] (apply str (mapcat (juxt count first) (partition-by identity s)))) "aaabddcejkkeddddddd")
"3a1b2d1c1e1j2k1e7d"
(into {} (map (juxt :k :v) [{:k 1, :v 2} {:k 3, :v 4}]))
{1 2, 3 4}
(apply into ((juxt vec #(apply map list %)) (partition 3 (range 9))))
[(0 1 2) (3 4 5) (6 7 8) (0 3 6) (1 4 7) (2 5 8)]
(map (juxt seq? sequential? associative?) ['(1 2 3) [4 5 6] {:foo :bar}])
([true true false] [false true true] [false false true])
(sort-by (juxt :a :b) [{} {:a 0, :b 1} {:b 3} {:a 12, :b 1}])
({} {:b 3} {:a 0, :b 1} {:a 12, :b 1})
((juxt (comp set filter) (comp set remove)) odd? #{1 2 3 4 5})
[#{1 3 5} #{2 4}]
(map (juxt :step :acc) [{:step 2, :acc :sharp, :d "foo"} {:step 3, :d "foo"}])
([2 :sharp] [3 nil])
(defn or-comp [args & fns] (let [f (apply juxt fns)] (some true? (f args))))
#'user/or-comp
((apply juxt [:a :b :c :d]) {:a 1, :b 2, :c 3, :d 4})
[1 2 3 4]
(sort-by (juxt second first) [[1 2] [2 1] [3 3] [2 3] [3 2]])
([2 1] [1 2] [3 2] [2 3] [3 3])
(map (juxt first count) (partition-by identity [:a :a :a :b :b :c :d :d]))
([:a 3] [:b 2] [:c 1] [:d 2])
(let [v [:a :b]] (map (apply juxt v) [{:a 1, :b 2, :c 3}]))
([1 2])
(letfn [(decorate [& fs] (apply juxt identity fs))] (map (decorate inc -) (range 5)))
([0 1 0] [1 2 -1] [2 3 -2] [3 4 -3] [4 5 -4])
(let [my-maps [{:foo "bar", :biz "baz"} {:foo "sds", :biz "sdasdasd"}]] ((apply juxt my-maps) :foo))
["bar" "sds"]
(map (juxt :foo :bar) [{:foo "foo", :bar "dummy", :axe "blood"} {:foo "baz", :bar "dummy"}])
(["foo" "dummy"] ["baz" "dummy"])
(defn or-fns [& fns] (fn [& args] (some true? (apply (apply juxt fns) args))))
#'user/or-fns
(into {} (map (juxt :id identity) '({:id 1, :data 123} {:id 2, :data 456})))
{1 {:data 123, :id 1}, 2 {:data 456, :id 2}}
(#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2, 3 4})
{1 3, 3 5}
(let [i 3] ((juxt #(subs % 0 i) #(subs % i)) "abcdefg"))
["abc" "defg"]
(map (juxt (partial + 1) (partial + 2) (partial + 3)) [1 2 3])
([2 3 4] [3 4 5] [4 5 6])
(sort-by (juxt first second) [[1 2] [2 1] [3 3] [2 3] [3 2]])
([1 2] [2 1] [2 3] [3 2] [3 3])
(let [m ["the" "quick" "brown" "fox"]] (apply (juxt (partial max-key count) (partial min-key count)) m))
["brown" "fox"]
(map (juxt class pr-str) [(list 1 2 3) (map inc [0 1 2]) (cons 1 ())])
([clojure.lang.PersistentList "(1 2 3)"] [clojure.lang.LazySeq "(1 2 3)"] [clojure.lang.Cons "(1)"])
(filter #(if-let [x (% {:yes 1})] ((juxt identity %) {:yes 1})) [:no :yes :bad])
(:yes)
((juxt #(do %& %1) (fn [& args] (nth args 1))) 1 2 3)
[1 2]
((juxt #(+ % 8) #(* % 3) #(mod % 2)) 12)
[20 36 0]
(let [q '(1 2 3)] ((juxt vec counted?) (concat q [4 5 6])))
[[1 2 3 4 5 6] false]
(defn and-fns [& fns] (fn [& args] (every? true? (apply (apply juxt fns) args))))
#'user/and-fns
((fn coerced-select [m keys] (into {} (map (juxt identity m) keys))) {:a 0} [:a :b])
{:a 0, :b nil}
(map (juxt println identity) [1 2 3 4 5 6 7 8 9 10])
([nil 1] [nil 2] [nil 3] [nil 4] [nil 5] [nil 6] [nil 7] [nil 8] [nil 9] [nil 10])
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n"
((apply juxt (map #(fn [c] (c %)) (range 5))) [:a :b :c :d :e])
[:a :b :c :d :e]
((comp first ((partial juxt (resolve (symbol (apply str (map char '(105 110 99)))))))) 1)
2
(map (juxt list? seq?) ['(a b c) (list 1 2 3) [1 2 3]])
([true true] [true true] [false false])
(->> clojure.core quote the-ns ns-publics seq rand-nth val meta ((juxt :name :doc)) (map println) dorun)
nil
"drop-last\nReturn a lazy sequence of all but the last n (default 1) items in coll\n"