(->> (remove nil? [nil nil 1.0 2.0]) (apply max))
2.0
(->> k (list :v) (for [k [1 2 3]]))
((:v 1) (:v 2) (:v 3))
(defn as-str [ks] (->> ks (map name) (apply str)))
#'user/as-str
(->> #(rand-int 2) (repeatedly 5) (fn []) (repeatedly 10))
((0 0 1 1 0) (0 1 0 0 1) (0 1 1 0 1) (0 1 0 0 0) (1 1 1 0 1) (1 0 1 0 0) (1 1 0 0 0) (0 0 1 0 1) (0 0 0 1 1) (0 0 1 1 1))
(->> {:foo 45} vals first (assoc {:text "flarp"} :id))
{:id 45, :text "flarp"}
(->> (range 10) rest (map #(/ % 10.0)))
(0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)
(->> :phew (catch Exception e) (try (/ 42 0)))
:phew
(->> (range 16) (map inc) (partition 4) (partition 2))
(((1 2 3 4) (5 6 7 8)) ((9 10 11 12) (13 14 15 16)))
(->> (range 6) (partition 2) (map #(second %)))
(1 3 5)
(macroexpand-1 '(->> [123] (doseq [x %] (prn x))))
(doseq [x %] (prn x) [123])
(->> "01110101001" (map {\0 \1, \1 \0}) (apply str))
"10001010110"
(= 25 (->> 5 ((fn [n] (* n n)))))
true
(macroexpand '(->> (a b) (c d) (e f)))
(e f (c d (a b)))
(->> {:a nil, :b :foo} (filter val) (reduce merge {}))
{:b :foo}
(->> (range 10) (mapcat #(when (even? %) [%])))
(0 2 4 6 8)
(->> '^:x (foo bar) (rest) (cons 'baz) (meta))
nil
(->> (+ a 5) (- 20) (let [a 9]))
6
(apply hash-map (->> [[:a 1] [:b 2]] (mapcat identity)))
{:a 1, :b 2}
(def dec-by #(->> dec (repeat %) (apply comp)))
#'user/dec-by
(first (->> (vector (remove nil? [nil nil])) (apply max)))
nil
(first (->> (vector (remove nil? [nil 1])) (apply max)))
1
((->> coll (map inc) (fn [coll])) [1 2 3])
(2 3 4)
(->> '([1 :a] [2 :c]) (apply (sorted-map-by <)))
[2 :c]
(->> (+ x y) (let [x 1 y 2]))
3
(macroexpand '(->> (range 5) (map inc) (map inc)))
(map inc (map inc (range 5)))
((->> (+ a b) (fn [a b])) 4 5)
9
(->> "one two" ((fn [x] (clojure.string/split x #" "))))
["one" "two"]
(->> {:c :d, :a :b} (sort-by key) (map val))
(:b :d)
(->> [[:a 1] [:b 2]] (apply concat) (apply hash-map))
{:a 1, :b 2}
(->> [0 1 2 3] (iterate next) (take-while some?))
([0 1 2 3] (1 2 3) (2 3) (3))
(->> (range 10) (map inc) (interpose 5) (reduce +))
100
(->> (list 1 2 3 4) (take 2) (first))
1
(->> 10 (#(+ % %)) (* 5) inc)
101
(-> 3 (+ 5) (->> (- 100)) (* 2))
184
(->> :v (list k) (for [k [1 2 3]]))
((1 :v) (2 :v) (3 :v))
(->> [1 2 nil 4] (filter identity) (reduce *))
8
(->> [nil 1 nil] (filter identity) (apply + 1))
2
(->> (iterate inc 1) (map + (range)) (take 5))
(1 3 5 7 9)
(macroexpand '(->> (range 5) (map inc) (map dec)))
(map dec (map inc (range 5)))
(->> "The\nquick\nbrown\nfox." (re-seq #"\w+") (interpose " ") (apply str))
"The quick brown fox"
(->> [:a 1 :b 2] (partition 2) (map vec))
([:a 1] [:b 2])
(->> 0 (iterate inc) (map int) (map type) (take 5))
(java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer)
(-> * (#(%)) inc (->> (def foo) deref) inc)
3
(macroexpand-1 '(->> [123] #((doseq [x %] (prn x)))))
(fn* [%1] ((doseq [x %1] (prn x))) [123])
(->> [2 {:op :value1} 3] (filter map?) (map :op) first)
:value1
(->> 5 range (map #(* 2 %)) (reduce +))
20
(-> {:a [1 2 3 4]} :a (->> (map inc)))
(2 3 4 5)
(->> (range 10) (filter #(rem % 3)) (reduce +))
45
(defn map-while [f coll] (->> coll (map f) (take-while f)))
#'user/map-while
(defmacro L->> [& forms] `(fn [x#] (->> x# ~@forms)))
#'user/L->>