(->> "123456789012" (partition 2) (map (partial apply str)) (interpose \-) (apply str))
"12-34-56-78-90-12"
(-> [{:a 0, :b 1} {:a 1, :b 2}] (->> (map :a)))
(0 1)
(->> [["one" 1]] ((fn [coll] (doseq [[f i] coll] (println f i)))))
nil
"one 1\n"
(apply str (->> "/my/test/path/" (drop-while #{\/}) reverse (drop-while #{\/}) reverse))
"my/test/path"
(->> (rest (map #(char (+ 64 %)) (range 26))) (take-nth 2))
(\A \C \E \G \I \K \M \O \Q \S \U \W \Y)
(->> (ns-publics 'clojure.core) (map (comp name first)) (filter #(re-matches #".*v$" %)))
("filterv" "reduce-kv" "mapv")
(->> contains? var meta :doc (re-seq #"\S+") (take 5) (clojure.string/join " "))
"Returns true if key is"
(defn get-name [] (->> 'clojure.core ns-publics keys shuffle (take 3) (clojure.string/join \-) symbol))
#'user/get-name
(->> (iterate dec 10) (take 20) (map #(/ 6 %)) (seque 5))
(3/5 2/3 3/4 6/7 1 6/5 3/2 2 3)
(->> (range 1 10) (map vector (range)) (filter (comp even? last)) (map first))
(1 3 5 7)
(->> {:a 3, :b 2, :c 1} (sort-by val) (map (juxt identity type)))
([[:c 1] clojure.lang.MapEntry] [[:b 2] clojure.lang.MapEntry] [[:a 3] clojure.lang.MapEntry])
(filter #(< 2 (->> % pr-str count)) (map char (range 0 256)))
(\backspace \tab \newline \formfeed \return \space)
(->> (seq "BCDEFG") (map int) (map (partial + 32)) (map char) (apply str))
"bcdefg"
(->> ["a" "z" "c"] (reduce #(if (neg? (compare %1 %2)) %2 %1)))
"z"
(->> {"match" 1, "nomas" 2} (filter (comp (partial re-matches #"mat.*") first)) first second)
1
(->> (+ 1 1 1 1 1 1 1) (repeat 2) (apply *))
49
(->> ["val1 key1" "val2 key2" "val3 key1"] (map #(clojure.string/split % #" ")))
(["val1" "key1"] ["val2" "key2"] ["val3" "key1"])
(defn repchar? [s] (->> s (partition 2 1) (some #(apply = %))))
#'user/repchar?
(->> #{3 4 5} (map (partial + 1)) (map (partial + 11)))
(16 15 17)
(->> '(1 2 3) (partition 2 1) (map #(apply + %)))
(3 5)
(macroexpand '(->> (iterate scratch.core/cuts [1 2 3 4]) (map count) (take-while pos?)))
(take-while pos? (map count (iterate scratch.core/cuts [1 2 3 4])))
(->> {:a 10, :b 20, :c 30} ((juxt :a :b :c :d)) (sort))
(nil 10 20 30)
(->> [1 2 7 9 8 5 1 0 1] (map odd?) frequencies)
{false 3, true 6}
(->> [1 1 3 1 3 1] (split-with #{3}) (remove #{3}))
(() (1 1 3 1 3 1))
(defn collapse-whitespace [s] (->> s (.split #"\s+") seq (interpose " ") (apply str)))
#'user/collapse-whitespace
(defn count-true [input & preds] (->> input ((apply juxt preds)) (filter true?) (count)))
#'user/count-true
(->> n dec f (* n) (if-not (pos? n) 1) (defn f [n]))
#'user/f
(->> (all-ns) (mapcat ns-publics) (map (comp name key)) (filter #(.endsWith % "!")))
("vswap!" "vreset!" "swap-vals!" "disj!" "conj!" "reset-vals!" "pop!" "compare-and-set!" "reset-meta!" "dissoc!" "assoc!" "reset!" "alter-meta!" "persistent!" "run!" "swap!" "volatile!")
(#(do (map (fn [x] (->> x class println)) %&) nil) '() [] #{})
nil
((fn qsort [[x & xs]] (if x (let [smaller? (partial >= x)] (concat (->> xs (filter smaller?) qsort) [x] (->> xs (remove smaller?) qsort))))) (repeatedly 20 (partial rand-int 256)))
(0 3 36 38 59 60 63 63 83 85 91 92 185 192 215 225 227 244 252 253)
(defn lerp [lo hi f] (->> (- hi lo) (* f) (+ lo)))
#'user/lerp
(defn gather-tests [testfilter nslist] (->> nslist (map ns-publics) (apply concat) vals (filter testfilter)))
#'user/gather-tests
(letfn [(identity [n] (->> (repeat n *) (map trampoline) (reduce +)))] (identity 42))
42
(->> [0 1 2] (mapv inc) (#(reduce conj % [11 12 13])))
[1 2 3 11 12 13]
(let [coll [:a :b :c :d]] (->> coll (cycle) (rest) (take (count coll))))
(:b :c :d :a)
(->> [1 1 1 2 2 2] (partition-by identity) (map (partial reduce +)))
(3 6)
(defn correct-answer-for [q] (->> q (reverse) (apply str) (read-string) (name) (reverse) (apply str)))
#'user/correct-answer-for
(->> [500 600 700] (map str) (map reverse) (map #(apply str %)))
("005" "006" "007")
(letfn [(identity [n] (->> (repeat n *) (map trampoline) (reduce +)))] (identity 0))
0
(->> (map compare [1 2] [1 2]) (some #{-1 1}) (or 0))
0
(->> (range 10) (remove #(zero? (* (rem % 5) (rem % 3)))))
(1 2 4 7 8)
(->> (iterate dec 2) (take 5) (map #(/ 6 %)) (seque 5))
(3)
(->> (map (fn [a b] [a (identical? a b)]) (range) (range)) (remove second) (ffirst))
128
((fn f [x] (->> (repeatedly rand) (take-while #(< % x)) (map f))) 0.8)
(((() () () ()) () () () ()) (((() () () ()) () (())) () () () () () (() ())) ((())))
(->> [true false true false false false false true false false] (group-by identity) vals)
([true true true] [false false false false false false false])
(->> (iterate dec 10) (take 20) (map #(/ 6 %)) (seque 5) (last))
3
(let [villas ["a" "b" "c"]] (->> (interleave villas (-> villas count range)) (partition 2)))
(("a" 0) ("b" 1) ("c" 2))
(let [line "version=123:foo=bar:something=moo"] (->> (.split line ":") (map #(vec (.split % "="))) (into {})))
{"foo" "bar", "something" "moo", "version" "123"}
(macroexpand '(->> [1 2 3] #(* 2 %) #(+ 5 %)))
(fn* [%1] (+ 5 %1) (fn* [%1] (* 2 %1) [1 2 3]))
(->> 'clojure.core ns-publics keys (map name) (filter #(.startsWith % "def")) (clojure.string/join " "))
"defmethod defonce defn- defprotocol defmulti defrecord"