(map (apply juxt [:a :b :c]) [{:a 0, :b 1, :c 2} {:a 1, :c 3, :d 4}])
([0 1 2] [1 nil 3])
((apply juxt (map (partial partial apply) [+ -])) ((reduce (partial partial reduce) (repeat 1 partial)) [1 2 3]))
[6 -4]
(map (comp (partial apply hash-map) (juxt :pos (comp vector :step))) [{:step 1, :pos :s1} {:step 2, :pos :s2}])
({:s1 [1]} {:s2 [2]})
(let [s [1 5 4 3 2 6 7]] ((comp (partial apply map max) (juxt identity rest)) s))
(5 5 4 3 6 7)
((juxt keys vals) {:a [34 56 7], :b [21 87 999], :c [3], :d [2 4], :s [4]})
[(:a :b :c :d :s) ([34 56 7] [21 87 999] [3] [2 4] [4])]
(every? #(apply (fn [x y] (and x y)) ((juxt string? empty?) %)) (list "" '(a b)))
false(reduce-kv #(assoc %1 %2 (first %3)) {} {:foo [{:bar :baz}], :bar [{:baz :bop}]})
{:bar {:baz :bop}, :foo {:bar :baz}}
(let [h {:foo "bar", :foo2 "bar"}] (for [[k v] h] [(name k) (keyword v)]))
(["foo" :bar] ["foo2" :bar])
(filter #(> (val %) 3) {:foo 1, :bar 2, :baz 4, :bing 5})
([:baz 4] [:bing 5])
(let [args [:foo "/foo" :bar "/bar"]] `(do ~(map str (partition 2 args))))
(do ("clojure.lang.LazySeq@5d847e33" "clojure.lang.LazySeq@5d2b26fe"))
(for [a [1 2 3 1] :while (< a 3) b [:foo]] [b a])
([:foo 1] [:foo 2])
(into {} (for [[k v] {:foo 3, :bar 6, :baz 9}] [k (* 2 v)]))
{:bar 12, :baz 18, :foo 6}
(let [m {'a 71, 'b :foo}] `(let [~@(apply concat m)] foo bar))
(clojure.core/let [a 71 b :foo] user/foo user/bar)
(map (fn [[k v]] {:key k, :value v}) {:foo "1 1", :bar "2 2"})
({:key :foo, :value "1 1"} {:key :bar, :value "2 2"})
(map (juxt sequential? associative?) [(cons 1 nil) (cons 1 '(2 3)) [4 5] {6 7} #{8}])
([true false] [true false] [true true] [false true] [false false])
(#(some (partial = 1) ((apply juxt [:x :y :z :a]) %)) {:a 1, :b 2, :c 3})
true(let [m (hash-map :a 1 :b 2) f (juxt type identity)] (f (into (empty m) (map identity m))))
[clojure.lang.PersistentHashMap {:a 1, :b 2}]
((juxt #(take-nth 2 %) #(take-nth 2 (next %))) '(1 + 2 + 3 + 4))
[(1 2 3 4) (+ + +)]
((juxt keys vals) {:a [4], :b [21 87 999], :c [3], :d [2 4], :s [34 56 7]})
[(:s :b :c :d :a) ([34 56 7] [21 87 999] [3] [2 4] [4])]
(swap! (atom {:foo 17}) (fn [the-map] (if (:non-existent the-map) the-map (assoc the-map :non-existent :bar))))
{:foo 17, :non-existent :bar}
(let [f (fn [& {:keys [foo bar]}] foo)] (apply f (flatten (seq {:foo 1}))))
1(let [m (assoc {} :foo :bar)] (if (= 3 3) (assoc m :been "baz") m))
{:been "baz", :foo :bar}
(into {} (map (fn [[k [v]]] [k v])) {:foo [{:bar :baz}], :bar [{:baz :bop}]})
{:bar {:baz :bop}, :foo {:bar :baz}}
(def foo [[1 [:hello] [:world]] [2 [:foo] [:bar]] [3 [:bad] [:good]] [1 [:evil] [:devil]]])
#'user/foo
(let [[x y & more] (seq {:foo 1, :bar 2, :baz 3})] (list y))
([:bar 2])
(= 2 (get-in {{:foo "foo"} {:session-id 1}, {:bar "bar"} {:session-id 2}} [{:bar "bar"} :session-id]))
true(let [a {} b (assoc a :foo 42) c (assoc b :bar "OK")] [a c])
[{} {:bar "OK", :foo 42}]
((fn [fk & ms] (into {} (map (juxt fk identity) ms))) :id {:a 2, :id 1} {:b 4, :id 5})
{1 {:a 2, :id 1}, 5 {:b 4, :id 5}}
(map (partial apply (juxt min max)) (apply map vector [[0 1] [2 3] [5 -1] [4 6] [-2 3]]))
([-2 5] [-1 6])
(for [b [:foo :bar] a [1 2 3 1] :while (< a 3)] [b a])
([:foo 1] [:foo 2] [:bar 1] [:bar 2])
(for [[k v] {:foo "bar", :baz "foobar"}] (list [:strong (str (:name k) ": ")] v))
(([:strong ": "] "bar") ([:strong ": "] "foobar"))
((partial (comp seq reduce) (comp (partial apply conj) (juxt first (comp (partial + 1) second)) list) []) (range 10))
(1 2 3 4 5 6 7 8 9 10)
(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 juxt [:a :b :c :d #(get % :e :baz)]) {:a 1, :b 2, :c 3, :d 4})
[1 2 3 4 :baz]
(let [num 20 div -6 [a b] ((juxt quot mod) num div)] (= (+ (* a div) b) num))
false(for [[k v] {:foo "bar", :baz "foobar"}] (list [:strong (str (name k) ": ")] v))
(([:strong "foo: "] "bar") ([:strong "baz: "] "foobar"))
(letfn [(f [coll] (for [a coll] [a (remove #{a} coll)]))] (f [:foo :bar :baz]))
([:foo (:bar :baz)] [:bar (:foo :baz)] [:baz (:foo :bar)])
(map (juxt identity true? false? boolean #(if % :then :else)) [0 5 {} [] "foo" :bar 'baz true false nil])
([0 false false true :then] [5 false false true :then] [{} false false true :then] [[] false false true :then] ["foo" false false true :then] [:bar false false true :then] [baz false false true :then] [true true false true :then] [false false true false :else] [nil false false false :else])
((fn [source sink & {:keys [close-when-done], :or {close-when-done false}}] [source sink close-when-done]) :foo :bar)
[:foo :bar false]
(apply concat ((juxt take-while (comp rest drop-while)) #(not= 4 %) [1 2 3 4 5 6 7 8 9]))
(1 2 3 5 6 7 8 9)
(defmacro defn' [name arglist & body] `(defn ~name ~arglist (let [~'&args ~(into {} (map (juxt keyword identity) arglist))] ~@body)))
#'user/defn'
(for [a [1 2 3 1] :while (< a 3) b [:foo :bar]] [b a])
([:foo 1] [:bar 1] [:foo 2] [:bar 2])
(for [a [1 2 3 1] b [:foo :bar] :while (< a 3)] [b a])
([:foo 1] [:bar 1] [:foo 2] [:bar 2] [:foo 1] [:bar 1])
(let [h {:foo "bar", :foo2 "bar"}] (map (fn [[k v]] [(name k) (keyword v)]) h))
(["foo" :bar] ["foo2" :bar])
(filter #(= (:session-id (val %)) 2) {{:foo "foo"} {:session-id 1}, {:bar "bar"} {:session-id 2}})
([{:bar "bar"} {:session-id 2}])
(let [x '(:foo "bar" :baz "spam")] (zipmap (take-nth 2 x) (take-nth 2 (rest x))))
{:baz "spam", :foo "bar"}
(into {} (map (fn [[k v]] [k (peek v)])) {:foo [{:bar :baz}], :bar [{:baz :bop}]})
{:bar {:baz :bop}, :foo {:bar :baz}}
(let [meta-m (fn [x] (with-meta {x x} {x x}))] (meta (merge (meta-m :foo) (meta-m :bar))))
{:foo :foo}
(let [a {:a {:deep :map}} b {:b 1}] [(assoc b :foo (:a a)) b a])
[{:b 1, :foo {:deep :map}} {:b 1} {:a {:deep :map}}]
(update {} :foo (fn [foo] (-> foo (update-in [:bar :quux] (fnil inc 0)) (assoc-in [:string] "string!"))))
{:foo {:bar {:quux 1}, :string "string!"}}

